Upload a file that lives on the website server to

2019-09-20 01:18发布

问题:

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!

回答1:

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

check ftp_exec

or you may send the file using