Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

post an image of input file using javascript to php file

is any way to post the image object to php file using javascript that can be alternative for the regular way of uploading image using (enctype="multipart/form-data") ?

I had successfully post values of input text boxes using ajax, any way to post input file fields ?

Thanks

like image 245
user504363 Avatar asked Nov 04 '22 22:11

user504363


2 Answers

There are several techniques for this.

One is to utilize an iFrame for the upload. Check this out: http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

like image 139
theduke Avatar answered Nov 09 '22 13:11

theduke


Using Iframe for this is one of the best method and keep track of the reponse in Iframe for image uploaded and as soon as you get desired response. Show the image uploaded message.

like image 36
Md Jawed Shamshedi Avatar answered Nov 09 '22 14:11

Md Jawed Shamshedi