var formData = new FormData();
formData.append("file", uploadFile.files[0]);
$.ajax({
url : '/${sysCd}/uploadFile.json',
data : formData,
type : 'POST',
dataType : 'json',
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData : false,
contentType : false,
success : function(data) {
alert('파일업로드 성공');
},
error : function(x, e) {
if (x.status == 0) {
alert('You are offline!!n Please Check Your Network.');
} else if (x.status == 404) {
alert('Requested URL not found.');
} else if (x.status == 500) {
alert('Internel Server Error.');
} else if (e == 'parsererror') {
alert('Error.nParsing JSON Request failed.');
} else if (e == 'timeout') {
alert('Request Time out.');
} else {
alert('Unknow Error.n' + x.responseText);
}
}
});
<input id="uploadFile" name="uploadFile" type="file" class="text full" />
IE는 10이상부터 적용가능
'JAVASCRIPT > JQUERY' 카테고리의 다른 글
Jquery 글자수 체크 (0) | 2019.10.26 |
---|---|
Jquery 동적폼 생성 (0) | 2019.10.26 |
Jquery 윈도우 크기 변경 (0) | 2019.10.26 |