2017-01-26 2 views
1

BlueImp jQuery 파일 업 로더 (https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin)를 사용하려고합니다. 그것은 잘 작동하지만, 입력 필드의 orinial name 속성 인 "files []"만을 가지고 작동합니다. 내가 다른 이름을 사용하는 경우 는, JSON 응답이 비어 :Blueimp jQuery 파일 업로드 - 입력 이름을 변경할 수 없습니다.

{ "파일": []}

이 내 코드입니다 :

<tr> 
    <td> 
     <label>Photos</label> 
    </td><td id="photos_container"> 
     <div class="progress"> 
      <div class="bar" style="width: 0%;"></div> 
     </div> 
     <span class="btn btn-success fileinput-button"> 
      <i class="glyphicon glyphicon-plus"></i> 
      <span>Select files...</span> 
      <input id="photos" type="file" name="photos[]" multiple> 
     </span> 
    </td> 
</tr> 

<script> 
    jQuery(document).ready(function($){ 
     $(function() { 
      $('#photos_container').fileupload({ 
       url: 'tmp/', 
       dataType: 'json', 
       fileInput: $('#photos'), 
       paramName: 'photos[]', 
       progressall: function (e, data) { 
        var progress = parseInt(data.loaded/data.total * 100, 10); 
        $('#photos_container .progress .bar').css(
         'width', 
         progress + '%' 
        ); 
       }, 
       done: function (e, data) { 
        $.each(data.result.files, function (index, file) { 
         $('<p/>').text(file.name).appendTo('#photos_container'); 
        }); 
       } 
      }); 
     }); 
    }); 
</script> 

내가 반복하지만, 코드는 잘 작동합니다 입력 버튼 "files []"의 기본 이름으로, 문제는 경로 문제가 아닙니다.

편집 : 내가 함께하고 fileinput 함수와 paramName에 옵션없이 노력하지만, 나는 name 속성이 자바 스크립트 요소를 참조하는 데 사용됩니다, 또는 양식이 후 양식 데이터를 참조 할

답변

0

를 작동하지 않았다 제출.

파일 데이터는 photos 속성에 있습니다.

관련 문제