开发者

PHP file upload - Track bytes uploaded with AJAX

I'm trying to figure out if there's a way to get the progress of a file开发者_开发百科 upload with PHP and/or Kohana. My script can upload images, videos, zip, exe, whatever I want really. However the larger the file the longer the user has to wait without any indication.

I was hoping to use some AJAX here to initialise the upload and then report back the progress.

Is this possible with PHP... and can anyone give me an indication of where to start looking.


there is a file upload progress extension for php, see http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/ for how to use it.


I like to use a server module to do this sort of thing, mainly because it makes my life as a web developer easier if all I need to do is grab upload statistics from a URL. Nothing has to be changed in your website.

For Nginx there is the Upload Progress module and it should work on all recent releases. You can find code examples on the Nginx Wiki: http://wiki.nginx.org/HttpUploadProgressModule

For Apache there is the Upload Progress too. I haven't used it myself, but it seems fairly straight forward.

If you don't have access to the server configuration, then you might want to fall back onto a pure flash / javascript solution. For this I had good luck with Uploadify in the past, but it requires a bit more work as you now have to upload files in a separate request. Someone should be able to suggest a good HTML5 upload progress plugin too.


you could do this also with apache and APC example

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜