File Uploading with progress bar

images php coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed Jun 29, 2011 2:52 am

File Uploading with progress bar

Postby parvezalam » Wed Jun 29, 2011 3:05 am

how can i insert a progress bar in my uploading script in php
my script is:::


$size = 150; // the thumbnail height

$filedir = 'pics/'; // the directory for the original image
$thumbdir = 'pics/'; // the directory for the thumbnail image
$prefix = 'small_'; // the prefix to be added to the original name

$maxfile = '2000000 kb';
$mode = '0666';

$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];

if (isset($_FILES['image']['name']))
$prod_img = $filedir.$userfile_name;

$prod_img_thumb = $thumbdir.$prefix.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));

$sizes = getimagesize($prod_img);

$aspect_ratio = $sizes[1]/$sizes[0];

if ($sizes[1] <= $size)
$new_width = $sizes[0];
$new_height = $sizes[1];
$new_height = $size;
$new_width = abs($new_height/$aspect_ratio);

or die('Problem In Creating image');
or die('Problem In opening Source Image');
or die('Problem In resizing');
or die('Problem In resizing');
or die('Problem In saving');

echo "You have successfully uploded";


echo '
<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data">
<input type="file" name="image"><p>
<input type="Submit" name="Submit" value="Submit">


User avatar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Re: File Uploading with progress bar

Postby gandahar » Wed Jun 29, 2011 6:21 am

you can use a framework, easiest way to do it

jquery have some good one, but there is lots of out there, take a look

bye :D

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 2 guests