모바일 & 앱
jQuery post file upload시 설정된 enctype 제거
Hippalus
2019. 1. 22. 13:12
반응형
<form name="frm" id="frm" enctype="multipart/form-data" method="post" autocomplete="off">
</form>
위 file upload용 처리페이지가 아닌 다른 페이지로 submit시킬 경우 해당 페이지도 upload request를 신경써야 하므로 전반적인 구조가 깨져버림
이때 enctype 속성을 아래와 같이 날려주면 구조를 살리며 개발이 가능함.
$("#frm").attr("enctype", "");
$("#frm").attr("target", "_self"); <-- 요건 window.open시 target을 변경했을경우 자신으로 target을 변경해주는 덤처리.(본 포스팅과는 무관)
반응형