简体   繁体   中英

Upload a file that lives on the website server to another service via ajax

I'm just wondering if what I propose is possible to do with any file, not just images.

Basically on the website server I have a assets directory with some generic files. These files can apply to a different number of things, like 'x_button.png' for a close button but there are also config.json files that are in that directory as well. I need the ability to push any one of these files to another server via AJAX.

Currently we use the file dialog and get a files array with the actual file and using formdata, push that up to the server.

For the images I could set an image tag to that local location then use the canvas to get the data uri and change that into a Blob but I am unsure if there is anything I can do for a .json file or even further any filetype.

I'm not looking for a written out solution, just if someone has encountered the need to do something like this before and the jist of the basic steps to solve the problem. Thanks!

you can call a php code with ajax to upload file via ftp

check ftp_exec

or you may send the file using

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