2012-08-13 1 views
1

Blueimp jQuery 파일 업로드 파일 프로그램 https://github.com/blueimp/jQuery-File-Upload을 사용하려고합니다. wiki & 설명서를 검색했지만 다운로드 할 수있는 파일을 필터링하는 방법에 대한 답변을 찾을 수 없습니다.blueimp jquery 다운로드 프로그램에서 다운로드 할 파일을 필터링하는 방법

인증 된 '보호 된'영역에서 사용하고 있습니다. 업로드 한 모든 파일을 인증 된 세션에서 사용할 수있는 고유 ID (예 : UID-filename.jpg)로 성공적으로 추가했습니다. 따라서 올바른 UID를 가진 것들만 선택하면됩니다.

다운로드 테이블을 보여줍니다 jQuery 코드이다 : 나는 매우 JS/jQuery를 경험하고 있지 않다

<!-- The template to display files available for download --> 
<script id="template-download" type="text/x-tmpl"> 
{% for (var i=0, file; file=o.files[i]; i++) { %} 
<!-- <tr class="template-download fade">--> 
    <tr class="template-download "> 
    {% if (file.error) { %} 
     <td></td> 
     <td class="name"><span>{%=file.name%}</span></td> 
     <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
     <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> 
    {% } else { %} 
     <td class="preview">{% if (file.thumbnail_url) { %} 
      <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a> 
     {% } %}</td> 
     <td class="name"> 
      <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a> 
     </td> 
     <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
     <td colspan="2"></td> 
    {% } %} 
    <td class="delete"> 
     <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"> 
      <i class="icon-trash icon-white"></i> 
      <span>{%=locale.fileupload.destroy%}</span> 
     </button> 
     <input type="checkbox" name="delete" value="1"> 
    </td> 
</tr> 

. 다음에해야 할 일에 대한 아이디어가 있으면 고맙겠습니다. 누구나 이러한 파일을 필터링하는 설정/옵션에 익숙합니다. 양자 택일로, 나는 그 파일이 파일명이나 경로의 배열이라고 생각한다. 나는 PHP로 필터링 될 수 있다고 생각한다. 아마 glob 함수를 사용할 것이다. 아무도 JS에서 이것에 대한 경험이 있는가?

플러그인 http://sunnywalker.github.io/jQuery.FilterTable/ 그것은 모든 테이블에서 작동하고 배포하기 쉬운을 사용

+0

나는 해결책을 향해 약간 진전을 보였습니다. 나는 github https://github.com/blueimp/jQuery-File-Upload/issues/1578에게 물었다. 플러그인 작성자는 서버 측에서 필터링을 제안했습니다. 나는 서버 쪽에서 필터링하는 방법을 설명하는 https://github.com/blueimp/jQuery-File-Upload/issues/1149를 찾았습니다. 나는 이것을했고 업로딩까지 작동합니다. 이제는 각 사용자가 자신의 이미지가 포함 된 고유 한 ID 번호라는 업로드 폴더의 하위 폴더가있는 설치 프로그램을 갖게되었습니다. 1 문제점 : 업로드 된 이미지가 보이지 않습니다. https://github.com/blueimp/jQuery-File-Upload/issues/1587을 참조하십시오. – user61629

답변

1

, 사전에 감사합니다.

는 종속성을 포함 :

<script src="/path/to/jquery.js"></script> 
<script src="/path/to/bindWithDelay.js"></script> <!-- optional --> 
<script src="/path/to/jquery.filtertable.js"></script> 
<style> 
    .filter-table .quick { margin-left: 0.5em; font-size: 0.8em; text-decoration: none; } 
    .fitler-table .quick:hover { text-decoration: underline; } 
    td.alt { background-color: #ffc; background-color: rgba(255, 255, 0, 0.2); } 
</style> <!-- or put the styling in your stylesheet --> 

코드를

<script> 
$('table').filterTable(); //if this code appears after your tables; otherwise, include it in your document.ready() code. 
</script> 

좋아요를 입력! 행운을 빕니다!