dimanche 18 décembre 2016

upload multipart form with ajax html [duplicate]

This question already has an answer here:

I have read another question where there was an explenation how to upload an image using ajax call, but what if i want an image and some text with it? and i want to get the response back to the current page, so i need to upload this form :

<form id="form" action="UploadImage" method="POST" enctype="multipart/form-data">
Select a file : <input id="image" type="file" name="image"/>
write a description : <input id="description" type="text" name="description"/>
<input type="submit" value="submit" />
</form>

and i need to get a small JSON string that look like this:

{"imgId" : 4356}

how can i do it? i read this post : Ajax Upload image




Aucun commentaire:

Enregistrer un commentaire