PHP는 이제 업로드 진행 상황을 추적 할 수 있습니다. "Session Upload Progress"을 참조하십시오.
이 기능을 사용하여 짧은 스크립트 (checkUpload.php
)를 작성하고 AJAX를 사용하여 상태를 IE9 페이지로 되돌립니다. 가 업로드 프로세스를 취소하려면
<?php
$_SESSION["upload_progress_123"] = array(
"start_time" => 1234567890, // The request time
"content_length" => 57343257, // POST content length
"bytes_processed" => 453489, // Amount of bytes received and processed
"done" => false, // true when the POST handler has finished, successfully or not
"files" => array(
0 => array(
"field_name" => "file1", // Name of the <input/> field
// The following 3 elements equals those in $_FILES
"name" => "foo.avi",
"tmp_name" => "/tmp/phpxxxxxx",
"error" => 0,
"done" => true, // True when the POST handler has finished handling this file
"start_time" => 1234567890, // When this file has started to be processed
"bytes_processed" => 57343250, // Number of bytes received and processed for this file
),
// An other file, not finished uploading, in the same request
1 => array(
"field_name" => "file2",
"name" => "bar.avi",
"tmp_name" => NULL,
"error" => 0,
"done" => false,
"start_time" => 1234567899,
"bytes_processed" => 54554,
),
)
);
사용하여 PHP는, 지금도 가능합니다. 위에서 언급 한 같은 매뉴얼 페이지에서 다음 텍스트를 제공 :
[ "cancel_upload"] 키에 $ _SESSION [$ 키]를 설정하여, 현재 진행중인 파일 업로드를 취소 할 수도 있습니다 참된. 동일한 요청으로 여러 파일을 업로드하는 경우 현재 진행중인 파일 업로드 만 취소되며 보류중인 파일 개가 취소되지만 완료된 업로드는 삭제되지 않습니다. 업로드가 처럼 취소되면 $ _FILES 배열의 오류 키가 UPLOAD_ERR_EXTENSION으로 설정됩니다.
PHP 문서에서 다룰 수없는 유일한 점은 전체 파일 크기를 얻는 방법뿐입니다. 이 프로세스에 대한 매우 좋은 리뷰가 있습니다 : "PHP Master | Tracking Upload Progress"
업로드 위젯을 사용해 보셨습니까? 이들 중 상당수는 플래시 폴백 (fallback) 기능이있어 끔찍한 브라우저에서 기능 패리티를 얻을 수 있습니다. – Charles
가능한 경우 플래시없이 구현하려고합니다. 그것이라고 생각하지 마라. ( –
나는 그것을 전에 사용했기 때문에 [Plupload] (http://www.plupload.com/)를 추천 할 예정이었고, 그것에 행운을 가져왔다. HTML5, Silverlight 및 Flash를 포함한 가능한 백엔드 목록. 실제로 진행중인 업로드를 취소 할 수는 없으므로 특정 문제가 해결되지 않습니다. – Charles