問題描述
有誰知道在PHP中創(chuàng)建文件上傳進度條的任何方法?我經(jīng)常聽說這是不可能的.
Does anyone know of any methods to create a file upload progress bar in PHP? I have often heard that it's impossible.
我有一個想法,但不確定它是否可行:正常上傳文件,而是提交到 iframe.提交后,將文件信息(大小和臨時位置)存儲在會話中.同時,每隔 10 秒啟動一次 AJAX 調用,以檢查文件的大小與會話中存儲的大小相比.這會將大小返回給 AJAX,然后會調整進度條的大小,并可能向用戶顯示上傳的大小.
I have one idea, but not sure if it would work: have a normal file upload, but instead submit to an iframe. When this is submitted, store the file information (size and temp location) in the session. At the same time, start an AJAX call to every say 10 seconds to check the size of the file compared to the size stored in the session. This would return the size to the AJAX and then a progress bar would be sized and maybe display the uploaded size to the user.
想法?
推薦答案
你可以試試YUI 或 原型 或 JQuery
You can try YUI or Prototype or JQuery
這篇關于在 PHP 中創(chuàng)建文件進度條的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!