开发者

ajax get file size

I'm trying to create a custom ajax upload for a project .

therefore dont want to use some open source scripts/codes.

So Here's the situati开发者_开发百科on

im trying to get upload size of the file using jquery ajax while the file is uploading by fetching file size of the file from a php file.

So i'll use .delay() to repeat process after a certain interval and '$_FILES['file'] ['tmp_name'] ' to fetch its name and size etc ..

can any body help me on how to do this ???

im a bit confused ..


With a standard install of PHP, you will not be able to track the upload of a file : once the upload is complete, you'll be able to work with $_FILES ; but not as long as the upload is in progress.


If you want to keep track of the progress of an upload, you'll have to either :

  • Install the APC extension, and configure apc.rfc1867 (there are a bit more informations on that page)
  • Install the uploadprogress extension, which has been created to do just that.


Here are a couple of articles that might give you some pointers :

  • APC : Monitoring File Uploads using Ajax and PHP
  • Upload Progress Meter - Common issues and some answers
  • Upload Progress Meter extension for PHP 5.2
  • AJAX File upload Progress and PHP AJAX File Upload Progress Meter Updates


From what I recall, when it comes to tracking files uploads, the second solution might be a better choice -- if I'm not mistaken, APC stores more stuff in RAM, which could cause some problems.
And here's a question+answer about that specific matter : APC vs pecl uploadprogress

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜