3
A
답변
2
당신은 파일 크기가 업로드하기 전에 파일 크기를 확인하는 uploadify 같은 것을 사용할 수 있습니다 확인하는 경우.
실제 파일 크기 (높이/너비)를 확인하려면 서버에서 수행해야 할 수 있습니다.
1
2
크롬에서이 코드를 테스트했으며 정상적으로 작동합니다. 이 같은
var x = document.getElementById('APP_LOGO'); // get the file input element in your form
var f = x.files.item(0); // get only the first file from the list of files
var filesize = f.size;
alert("the size of the image is : "+filesize+" bytes");
var i = new Image();
var reader = new FileReader();
reader.readAsDataURL(f);
i.src=reader.result;
var imageWidth = i.width;
var imageHeight = i.height;
alert("the width of the image is : "+imageWidth);
alert("the height of the image is : "+imageHeight);
0
뭔가 또는 "복수"없이 비동기 적으로로드 형태의 입력에 대처해야 설정하고 FileReader.readAsDataURL 및 Image.src를 사용할 때 일어나는 경쟁 조건을 피하십시오.
$('#formContainer').on('change', '#inputFileUpload', function(event) {
var file, _fn, _i, _len, _ref;
_ref = event.target.files;
_fn = function(file) {
var reader = new FileReader();
reader.onload = (function(f) {
return function() {
var i = new Image();
i.onload = (function(e) {
var height, width;
width = e.target.width;
height = e.target.height;
return doSomethingWith(width, height);
});
return i.src = reader.result;
};
})(file);
return reader.readAsDataURL(file);
};
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
_fn(file);
}
});
참고 :
<div id="formContainer">
<form ...>
...
<input type="file" id="inputFileUpload"></input>
...
</form>
</div>
0
당신은 이미지 너비와 높이 이미지 온로드를 확인해야합니다 같은 구조에 jQuery를, HTML5, 후크를 필요로한다.
var img = new Image;
img.src = URL.createObjectURL(file);
img.onload = function() {
var picWidth = this.width;
var picHeight = this.height;
if (Number(picWidth) > maxwidth || Number(picHeight) > maxheight) {
alert("Maximum dimension of the image to be 1024px by 768px");
return false;
}
}
관련 문제
- 1. 심포니 이미지 업로드 크기 조정
- 2. 업로드 전 이미지 크기 조정
- 3. 이미지 크기 및 PHP 업로드
- 4. Oracle UCM에서 업로드 된 파일의 크기 확인
- 5. codeigniter 이미지 업로드 및 크기 조정 - swfupload
- 6. rails3에 업로드 된 이미지의 동적 이미지 크기
- 7. 업로드 된 이미지 크기 조정 - PHP
- 8. 업로드 및 크기 조정 Aspx에서 이미지
- 9. Silverlight 3의 업로드 된 이미지 크기 조정
- 10. 이미지 업로드, MySQL의 스토어 경로 크기 조정
- 11. ASP.NET MVC : 이미지 업로드 유효성 확인
- 12. 업로드하기 전의 파일 크기 및 MIME 유형
- 13. 자바 이미지 크기 조정 (3 크기)을 Amazon S3에 업로드
- 14. 다중 이미지 업로드 및 크기 조정 이미지 : SECURITY
- 15. CKeditor 업로드 파일 확인
- 16. 저장시 이미지 크기 변경
- 17. iOS에서 이미지 크기 처리
- 18. 드루팔 이미지 업로드 문제
- 19. 업로드 이미지 PHP 문제
- 20. 이미지 업로드 - 반환 URL
- 21. 이미지 크기 축소 크기 조정
- 22. ckfinder 이미지 크기 조정
- 23. 업로드 이미지의 표준 크기 (PHP)
- 24. 업로드시 파일 크기 확인 방법
- 25. ASP.NET에서 이미지 크기 조정 -
- 26. jquery로 이미지 크기 조정
- 27. 업로드 된 파일의 크기
- 28. 확인 이미지
- 29. Jupload - 업로드 확인 문제
- 30. MVC 파일 업로드 확인