Sencha enctype="multipart/form-data"에서 파일 여러개 처리하기
2025. 1. 27. 22:15ㆍJavascript/Sencha
'Content-Type': null 설정
동일한 이름으로 파일 객체를 추가
const formData = new FormData();
formData.append('param1', 'abc');
formData.append('param2', '111);
formData.append('_csrf', document.getElementById('_csrf').innerText);
// Add files to the form data
newRows.forEach(record => {
formData.append('files', record.file); // Use 'files' as the key
});
Ext.Ajax.request({
url: '/url',
rawData: formData,
headers: {
'Content-Type': null // Let the browser handle the multipart boundaries
},
success: function(response) {
console.log('File upload successful');
},
failure: function(response) {
console.error('File upload failed');
}
});
'Javascript > Sencha' 카테고리의 다른 글
Sencha 첨부파일 input의 값이 'undefined'인 경우 처리 (0) | 2025.01.27 |
---|---|
Sencha grid에서 추가된 row와 변경된 row 구분하기 (0) | 2025.01.27 |
Sencha 서버 없이 local 디렉토리에서 CORS 에러 발생했을 때 (0) | 2025.01.26 |
Sencha grid에 record 추가 후에 변경상태로 설정하기 (0) | 2025.01.26 |
Sencha drag and drop 적용시, 서버 호출로 인해서 객체가 초기화 되는 경우 (0) | 2025.01.26 |