Blueimp/jQuery-File-Upload 프로젝트를 사용하려고하는데 사진을 다운로드하기 만하기 때문에 파일 확장자를 테스트하고 싶습니다. 누군가 나에게 어디에서 어떻게 보여 주는지 blueimp 구성해야/jQuery를 - 파일 - 업로드 그래서 내가 할 수있는이Blueimp/jQuery-File-Upload의 필터 파일
단순히 같은 파일 형식에 대한 정규식에 대한 옵션을 설정할 수 있습니다 문서에 명시된 바와 같이
1
A
답변
0
:
$('#fileupload').fileupload('option', {
url: '//localhost/',
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
process: [
{
action: 'load',
fileTypes: /^image\/(gif|jpeg|png)$/,
maxFileSize: 20000000 // 20MB
},
{
action: 'resize',
maxWidth: 1440,
maxHeight: 900
},
{
action: 'save'
}
]
});
0
나는이 add method 발견
여기 내 대구 .GPX 파일 E :
$('#fileupload').fileupload({
// your fileupload options
add:function(e,data){
data.files.map(function(i){
if(i.type!='application/gpx+xml'){
alert('please upload only .gpx files');
}else{
data.submit();
}
}),
process: function(e,data){/* your process actions here */}
});
0
당신의 필터 파일에 대한 방법 add
을 사용할 수 있습니다 : 그것은 작동하지 않을 것
var $input = $('#upload_input');
$input.fileupload({
fileInput: $input,
url: 'YOU_URL',
// Other options...
start: function(e, data) {
// Before start upload... Please wait...
},
add: function(e, data) {
types = /(\.|\/)(gif|jpe?g|png)$/i;
file = data.files[0]
if (types.test(file.type) || types.test(file.name)) {
data.submit();
} else {
// alert('Unfortunately, we don’t support that file type. Try again with a PNG, GIF, JPG');
return;
}
},
done: function(e, data) {
// After upload... alert('Done');
},
fail: function(e, data) {
// Error. Please try again later...
}
});
관련 문제
- 1. JQuery 필터 파일 수정
- 2. 여러 파일 형식의 필터
- 3. 메모장 ++ 파일 필터
- 4. Regex 파일 확장자 필터
- 5. 파일 시스템 필터 MiniDriver
- 6. 파이썬 필터 로그 파일
- 7. JFileChooser - 여러 파일 필터?
- 8. JFileChooser에서 파일 필터 적용
- 9. 정규식을 정의하여 필터 로그 파일
- 10. Alfresco 공유 파일 업로드 필터
- 11. JSF 파일 업로드 필터 구성
- 12. gcov 필터 결과 및 파일
- 13. 필터 P4 .Net 파일 목록
- 14. Windows 파일 시스템 필터 드라이버
- 15. 필터
- 16. 공통 파일 탐색기 용 인 텐트 필터
- 17. JUnit 테스트를 무시하기위한 FindBugs 필터 파일
- 18. 파일 업로드/업로드, 필터 할 문자 C#
- 19. html 파일 선택 대화 상자에 필터 만들기
- 20. 업로드 파일 확장자 필터 옵션이 작동하지 않습니까?
- 21. Findbugs-Plugin 용 XML 파일 (필터) 경로
- 22. 디렉토리에서 파일을 읽고 Java에서 필터 파일
- 23. .net "필터"에서 특정 파일 형식 무시.
- 24. AsyncFileUpload 컨트롤에 대한 파일 필터 설정
- 25. 이클립스에서 파일 필터 플러그인 (패키지 탐색기 - 네비게이터에서)
- 26. Eclipse + FindBugs - 필터 파일 제외가 작동하지 않습니다.
- 27. diff 파일에서 필터 파일 이동 및 복사
- 28. 최상의 리눅스 파일 시스템 필터 옵션은 무엇입니까?
- 29. 필터 및 전자 메일 Excel 파일 (VBA)
- 30. 사용자 정의 파일 유형을위한 인 텐트 필터
, 그것은 당신이 가지고 :( –
기본적으로 존재 fileupload 메소드의 옵션을 수정하십시오. 나는 나의 대답을 업데이트했다. 무엇을 설정하려고합니까? – dasheddot
오류 : 초기화 전에 fileupload에서 메서드를 호출 할 수 없습니다. 메서드 '옵션'을 호출하려고 시도했습니다. – strongBAD