How to upload files in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to upload files in html

3rd Sep 2017, 1:10 PM
Jishu
Jishu - avatar
4 Answers
+ 6
@Edson thank you so much
3rd Sep 2017, 2:17 PM
Raz
Raz - avatar
+ 5
@Edson What if I want to upload images, or something else apart from a form?
3rd Sep 2017, 1:56 PM
Raz
Raz - avatar
+ 3
1) put in your form the follow attributes: enctype="multipart/form-data" 2) use the method POST for submit your form; 3) Use the type "file" in a <input> tag **************** EXEMPLE ******************* <!DOCTYPE html> <html> <body> <form action="file_to_received_data.php" method="post" enctype="multipart/form-data"> <input type="file" name="input_name"> <input type="submit" value="Upload" name="submit"> </form> </body> </html>
3rd Sep 2017, 1:47 PM
Edson
Edson - avatar
+ 3
@neicore For multiples uploads at the same time, use the boolean attribute "multiple" in a <input> tag Exemple: <input type="file" name="my_file" multiple /> You must use a form in your web page to get a file. You can put several forms at the same page (without nested them), one just to get the files, but the data will be sent separeted, even the target attribute points to the same place.
3rd Sep 2017, 2:16 PM
Edson
Edson - avatar