2

I want to implement PHP uploading Progress Bar and My idea is to get the size of $_FILES['file']['tmp'] after each second.
But what is problem here, when a file is uploading there exist no file in temp directory set in php.ini but file successfully uploaded and when i try to get size of $_FILES['file']['tmp'] it show error warning.

<br />
<b>Warning</b>:  filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for D:\Program Files\webserver\temp\phpDD05.tmp in <b>D:\Program Files\webserver\www\test\upload\uploading.php</b> on line <b>5</b><br />

which mean i think file not exist. How we can converge this idea to success for uploading with progress bar

Wasim A.
  • 9,660
  • 22
  • 90
  • 120
  • 1
    Ajax upload progress bar, [check example](http://www.webdavsystem.com/server/documentation/upload/ajax_upload_progress_bar) – safarov Mar 29 '12 at 18:45

2 Answers2

0

You can try something like this to see if there's an error, then grab the file size if there are no errors.

<?php
if ($_FILES["file"]["error"] > 0)
{
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
}
?>

What does that do for you?

0

File is incapsulated in the POST request, so you need something outside your form that uploads the file and something that monitors periodically the file. I suggest some already made solutions like ajax upload progress bar or similar

kappa
  • 1,559
  • 8
  • 19