Having a progress bar in PHP while uploading a file to the server

I have 2 php files, where the first is the form at which you will have upload text area, and here is its code:
<form name="testform" method='POST' action='fileupload.php'>
<table border="0" cellspacing="0" bgcolor=WHITE align="center" >
<tr>
<td bgcolor=RED><font size="2" face="Arial" color=BLACK><b>Load File<br>PDF Only</b></font></td>
</td>
<td>
<input name="uploaded" type="file" size="50" maxlength="50" />
</td>
</tr>
<td colspan="2">
<center><input type="image" src="img/upload.gif" VALUE="Upload File" alt="Upload" /></td></center>
</td>
</tr>
</table>
</form>

And the second php (fileupload.php) is the action file, and here is its code:
<?php
$target = "filetmp/";
$uploaded_type=$_FILES['uploaded']['type'];
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is the only file type allowed
if (!($uploaded_type=="application/pdf"))
{
echo "You may only upload PDF files.<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

I want to insert a progress bar showing the file upload progress or at least a pop up window asking the user to wait until the file is uploaded, and then it disappears once the file is uploaded or rejected because of type mismatch, can someone tell me how can I do so with PHP?
Ashraf-HassanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NeoAshuraCommented:
this is the one i use for my site.. its very good and useful if u have any problems with it gimme a shout but it tells u EXACTLY what to do.

http://www.inaflashuploader.com/
0
Ashraf-HassanAuthor Commented:
The problem is that I can not use flash because iPhone does not support flash, is there any solution which is pure php?
0
leakim971PluritechnicianCommented:
Hello Ashraf-Hassan,

Php + Ajax one : http://www.seemysites.net/projFolder/uploader/

Regards.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

NeoAshuraCommented:
apologies didnt realise u where using the Iphone.. just a little tech thing.. Blackberry will soon be compatable with Flash.. :)
0
Ashraf-HassanAuthor Commented:
Well the Problem that Apple is not that friendly, it has been requested many many times to support flash by their users, but there is no clear justification.
leakim971, I downloaded the script, but unfortunately it is not working because of the json, my php is 5.1.x, do you have another package?
0
leakim971PluritechnicianCommented:
You've a class in the mail folder. Not the good one ?
0
Ashraf-HassanAuthor Commented:
Sorry I did not get your point, which mail folder?
0
leakim971PluritechnicianCommented:
not "mail", but "main" sorry
0
Ashraf-HassanAuthor Commented:
I think it needs json, I tried it, and it it is not working, I just get the upload spead 0.0 B/s, then nothing working in the bar nor the file is uploaded, what do you think?
0
leakim971PluritechnicianCommented:
What if your plateform ? Can you run CGI script (upload.cgi) ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ashraf-HassanAuthor Commented:
Thank you so much it is working.
0
leakim971PluritechnicianCommented:
You're welcome! Thanks for the points!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.