2012-07-11 3 views
1

나는 업로드 진행 모듈이 어떻게 작동하는지 이해하지 못한다. 그래서 나에게도 잘 작동하지 않는다. 그래서 ...Nginx 업로드 진행률 모듈

나는 모든 업로드 모듈 (의 nginx, nginx를-엑스트라)와 nginx를 설치 한

1)와 PHP-FPM

2) 본 프로젝트에 대한 내의 nginx 설정의 일부입니다

location ~ \.php$ { 
    include /etc/nginx/fastcgi_params; 
    fastcgi_pass 127.0.0.1:9000; 
    fastcgi_param SCRIPT_FILENAME /home/cha0s/learnphp$fastcgi_script_name; 
    fastcgi_param PATH_INFO $fastcgi_script_name; 

    track_uploads proxied 1m; 
} 

location ~ ^/files/(.*)$ { 
     alias /home/cha0s/$1; 
     internal; 
} 

location ^~ /progress { 
     # report uploads tracked in the 'proxied' zone 
     report_uploads proxied; 
} 

3)이 페이지의 하단에있는 자습서를 따랐습니다 : http://wiki.nginx.org/HttpUploadProgressModule :

그래서 난 형태를 가지고 진행 표시 줄을 업로드 :

<form id="upload" enctype="multipart/form-data" action="index.html" method="post"> 
    <input name="file" type="file"/> 
    <input type="submit" value="Upload"/> 
</form> 
<div id="uploading"> 
    <div id="progress" class="bar"> 
    <div id="progressbar"> </div> 
    <div id="percents"></div> 
    </div> 
</div> 
JQuery와 스크립트 트리거

JS 코드 :

<script type="text/javascript"> 
    $(document).ready(function(){ 
     $('form').uploadProgress({ 
     /* scripts locations for safari */ 
     jqueryPath: "/static/js/jquery.js", 
     uploadProgressPath: "/static/js/jquery.uploadProgress.js", 
     /* function called each time bar is updated */ 
     uploading: function(upload) {$('#percents').html(upload.percents+'%');}, 
     /* selector or element that will be updated */ 
     progressBar: "#progressbar", 
     /* progress reports url */ 
     progressUrl: "/progress", 
     /* how often will bar be updated */ 
     interval: 2000 
     } 
    }); 
    </script> 

그리고 그 스크립트를 https://github.com/drogus/jquery-upload-progress/blob/master/jquery.uploadProgress.js

질문과 문제 :

1) 첫 번째 문제 i 내가 항상 돌아온다. ({ "state": "starting"}); ...

2) 두 번째 질문은 내가이 작업을하기 시작한 이유는 파일을 슬라이스로 잘라 서버에 보내는 PHP 스크립트를 작성하려고했기 때문입니다. 거대한 파일을 업로드하고 진행률 막대를 모니터링하십시오. 하지만 나는 심지어 작은 예제 또는 튜토리얼을 PHP와 upload_progress_module 또는 w/e로 처리하는 방법을 찾을 수 없었다.

아니요, 저는 플래시 기반 업 로더를 원하지 않습니다.

그래서 나는 이미 혼란 스럽다고 생각합니다. 그래서 내가 어떻게 할 수 있는지 설명하고 이미 존재하는 구성으로 문제를 해결하는 데 도움이된다면

답변

1

action="index.html"location ~ \.php$으로가는 요청처럼 보이지 않습니다.

+0

죄송합니다 ... 죄송합니다 ... 내 파일에서 test.php로 설정했습니다. 튜토리얼에서 붙여 넣은 부분 만 복사하십시오. – Viktor

0

확실하지 여전히이 문제가 발생하지만 ... 일부 솔루션은 아래를 참조하는 경우

  1. 없음 upload_pass 값을 지정하지 않았습니다
  2. 없음 upload_store는
  3. 는 일단 upload_store 해시 디렉토리가 필요로 지정된 지정되지 올바른 권한으로 작성해야합니다
  4. "/ 업로드"작업을 양식에 추가하고 업로드 도메인의 해당 위치로 양식을 전송하는 것이 더 적합합니다 (양식 도메인과 다른 경우)
  5. 나는 json의 'starting'값에 기초하여 2 번째와 3 번째 점에서 디렉토리 문제를 발견했다고 생각합니다.
  6. GET 매개 변수 'X- 진행 상태 - ID = [맞춤 업로드 ID 번호] '상태를 추적 할 수 있습니다.
관련 문제