简体   繁体   中英

Upload image to server from input type=file

I have a <input type='file' /> in which the user can upload an image. I want to save that image as a server file(let's say 'hello.jpg') How can I do that using javascript?

Do you want just upload file with js? If so you can use this plugin https://blueimp.github.io/jQuery-File-Upload/

The server will need to run a backend that can accept form POST requests containing files you would like to upload. A common Javascript-based backend is the Node.js express module. The formidible module can be used to parse incoming file POST forms.

I would recommend building a proof-of-concept first to get an idea for all the technologies involved.

Here are some tutorials I found that would be relevant:

https://howtonode.org/really-simple-file-uploads

https://codeforgeek.com/2014/11/file-uploads-using-node-js/

https://coligo.io/building-ajax-file-uploader-with-node/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM