Uploading both data and files in one form using Ajax?

后端 未结 10 861
无人共我
无人共我 2020-11-21 05:48

I\'m using jQuery and Ajax for my forms to submit data and files but I\'m not sure how to send both data and files in one form?

I currently do almost the same with b

10条回答
  •  攒了一身酷
    2020-11-21 06:25

    you can just append them on your formdata, add your files and datas in it.you can read this..

    https://developer.mozilla.org/en-US/docs/Web/API/FormData/append

    for better understanding. you can separately retrieve them $_FILES for your files and $_POST for your data.

提交回复
热议问题