はPECL拡張モジュールを必要とします。ユーザーに進行状況を表示するために必要なコードの
uploadprogress
良い例です。
Uber Uploader
私が間違っていないのであれば、JQueryを使ってPHPと通信しています。
あなた自身でも書くことができます。複雑ではありません。
UPLOAD_IDENTIFIER
という名前のアップロードフォームの最初の要素として隠し要素を追加します。
投票これは、次のことを含む配列を返すuploadprogress_get_info(UPLOAD_IDENTIFIER)
を呼び出すPHPスクリプト:
time_start - The time that the upload began (unix timestamp),
time_last - The time that the progress info was last updated,
speed_average - Average speed in bytes per second,
speed_last - Last measured speed in bytes per second,
bytes_uploaded - Number of bytes uploaded so far,
bytes_total - The value of the Content-Length header sent by the browser,
files_uploaded - Number of files uploaded so far,
est_sec - Estimated number of seconds remaining.
は、PHPはJavascriptに情報を返し、あなたはたくさんの情報を持っている必要がありましょう。 視聴者に応じて、利用可能なすべての情報を使用しない可能性があります。
私はこれを答えとしてマークしました。なぜなら、SWFUploadを使うのが最も簡単な方法だからです。 :) –
simpelestはい、しかし、私はそれが "純粋なPHP/AJAX"の資格はないと思いますか? :) – Jacco