开发者

Why on ajax postbacks form content-type can not be multipart/form-data?

开发者 https://www.devze.com 2023-03-10 15:45 出处:网络
I have a page where form\'s content-type is set to enctype=\"multipart/form-data\". The page contains <input type=\"file\" tag and an button that posts(initiates upload). Both are inside of a panel

I have a page where form's content-type is set to enctype="multipart/form-data". The page contains <input type="file" tag and an button that posts(initiates upload). Both are inside of a panel that is updated via ajax. Clicking the button generates a xmlhttp request which whose content-type is application/x-www-form-urlencoded.

Basically the enctype of the form is ignored when the upload input is inside container that is updated via ajax.

There is lots of posts saying that you can't have multipart/form-data with a开发者_StackOverflow中文版jax. Why is this?


You can create multipart POST request - see this:

XMLHttpRequest POST multipart/form-data

0

精彩评论

暂无评论...
验证码 换一张
取 消