Image uploading using only single upload button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Image uploading using only single upload button

i wanna upload an image on web page without using choose file option rather only upload button should appear which will be doing both the things first selects file and once file is selected then submits it. I tried it using only one input field type text and tried to get its value using "onchange" event on this input field but on printing filename in JavaScript i got filename as "C\fakepath\filename.ext" (as file was in C drive). Can anyone tell how can i upload img using single button wid jquery nd other

5th Aug 2017, 12:41 PM
Mohammad Aasim
1 Answer
+ 1
Simply try to create input type file and once you choose the file call ajax function for upload file by the event on change handled on input file
10th Aug 2017, 10:37 PM
Mokhtar Tlili
Mokhtar Tlili - avatar