Home > Software engineering >  How can I upload a file in an FTP server using javascript?
How can I upload a file in an FTP server using javascript?

Time:09-19

I want to upload a file to an FTP server.

I'm using Angular but after some research I realized that Angular has no way to upload files to FTP. So I tried to follow this code but I didn't have any success because 'new FtpConnection()' is not recognized by javascript.

Is there any other valid code to upload a file to FTP via javascript or do I need to upload the file to FTP via the backend? (I use c# in backend)

CodePudding user response:

JavaScript has no native mechanisms for handling input and output, including FTP communication. It depends on the host environment to provide APIs for that.

Browsers (which I assume you are using given your tag) do not provide JS with an API for making FTP uploads, so you cannot.

(The question you reference is about JS running in Adobe Photoshop, not in a web browser).

The closest you could get would be to write a web service which you could send a file to via HTTP and then have it make the FTP upload.

CodePudding user response:

I am a little unsure as to your question. I used this kind of interface for doing the same FTP file upload by scripts. Please refer to this article below

https://web.dev/read-files/

  • Related