简体   繁体   English

如何使用 javascript 在 FTP 服务器中上传文件?

[英]How can I upload a file in an FTP server using javascript?

I want to upload a file to an FTP server.我想将文件上传到 FTP 服务器。

I'm using Angular but after some research I realized that Angular has no way to upload files to FTP.我正在使用 Angular 但经过一些研究后我意识到 Angular 无法将文件上传到 FTP。 So I tried to follow this code but I didn't have any success because 'new FtpConnection()' is not recognized by javascript.因此,我尝试遵循此代码,但没有成功,因为 javascript 无法识别“new FtpConnection()”。

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?是否有任何其他有效代码可以通过 javascript 将文件上传到 FTP,还是我需要通过后端将文件上传到 FTP? (I use c# in backend) (我在后端使用 c#)

JavaScript has no native mechanisms for handling input and output, including FTP communication. JavaScript 没有处理输入和 output 的本机机制,包括 FTP 通信。 It depends on the host environment to provide APIs for that.它依赖于主机环境来为此提供 API。

Browsers (which I assume you are using given your tag) do not provide JS with an API for making FTP uploads, so you cannot.浏览器(我假设你正在使用你的标签)不为 JS 提供 API 来进行 FTP 上传,所以你不能。

(The question you reference is about JS running in Adobe Photoshop, not in a web browser). (您提到的问题是关于在 Adobe Photoshop 中运行的 JS,而不是在 web 浏览器中运行的)。

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.您可以得到的最接近的方法是编写一个 web 服务,您可以通过 HTTP 将文件发送到该服务,然后让它上传 FTP。

I am a little unsure as to your question.我有点不确定你的问题。 I used this kind of interface for doing the same FTP file upload by scripts.我使用这种接口通过脚本执行相同的 FTP 文件上传。 Please refer to this article below请参考下面这篇文章

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用javascript将文件上传到FTP服务器? - How to upload a file to FTP server with javascript? 使用“ jQuery文件上传插件”将文件直接上传到FTP服务器 - Upload files directly to the FTP server by using “Jquery file upload plugin” 如何使用FormData将文件上传到服务器? - how can i upload file to server using FormData? 如何在不使用FormData的情况下以JavaScript和PHP上传文件 - How can I upload file in JavaScript and PHP without using FormData 如何使用 Javascript 创建无格式文件上传? - How I can create a formless file upload using Javascript? 使用JavaScript通过FTP上传文件(Chrome扩展程序) - Upload file via FTP using javascript (Chrome Extension) 如何使用PHP或Javascript上传文件(图像,视频,文档) - How can I upload a file (image, video, document) with one upload using PHP or Javascript 如何使用 javascript 检查上传到服务器的文件是否为空白? - How can I check if the file uploaded to the server is blank using javascript? 如何使用JavaScript将csv文件从NetSuite的文件柜传递到ftp服务器? - How to pass the csv file from file cabinet in NetSuite to ftp server using JavaScript? JavaScript可以获取文件上传到FTP服务器的日期吗? - Can JavaScript get the date when a file was uploaded to an FTP server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM