是否可以在 ASP.net MVC 上使用 SFTP 直接上传到远程服务器

发布于 2024-08-09 10:53:32 字数 325 浏览 3 评论 0原文

我目前正在使用 asp.net MVC 开发一些东西,我仍然没有使用它的经验,所以请帮助我。

我有一个供用户上传视频的表单。目前上传到远程服务器的理想概念是上传到当前服务器,然后使用FTP推送到远程服务器。

对我来说,这不是很快,因为你必须上传到当前服务器(时间 x1),然后当前服务器推送到新服务器(时间 x2),所以时间是原来的两倍。

所以我的想法是让用户将其上传到当前服务器,并且用户上传时,当前服务器将文件添加到数据库,同时使用SFTP将文件发送到远程服务器...

这可能吗?这个概念是否存在安全漏洞?

非常感谢

I am currently develope something using asp.net MVC, im still quite not experience with it so please help me out.

I have a form for user to upload Video. The current ideal concept to upload to remote server is to Upload it to to the current server, then use FTP to push it to a remote server.

For me, this is not quite fast since you have to upload to current server (Time x1) and then the current server push to new server (Time x2) so it's double the time.

So my idea is to make user upload it to the current server, and WHILE user is uploading, the current server add the file to DB and also send the file to the remote server at the same time using SFTP...

is it posible and are there any security hole in this concept?

Thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

海拔太高太耀眼 2024-08-16 10:53:32

我建议您使用 NULL Ftp Server 进行测试。如果您使用 Filezilla 客户端连接到它,您会注意到它会提示用户接受 ssl 密钥。它的执行方式与 putty.exe 或任何 SSH 客户端的执行方式相同。

因此,您的代码只需要接受 SSL 连接,然后从那时起,它只是常规的 FTP 命令。

以编程方式,我不知道如何接受证书,因此我可以建议的是您设置一个批处理文件来运行 Putty sftp 客户端并推送文件,然后让您的代码调用该批处理文件。我很确定 ASP 支持调用批处理文件。

I'd recommend using the NULL Ftp Server for your testing. If you connect to it using Filezilla client you'll notice that it prompts the user to accept the ssl key. It does that in the same way that putty.exe or any SSH client does.

So, you code just needs to accept the SSL connection and then from that point forward it is just regular FTP commands.

Programmatically, I dont know how to accept the cert and so all I can suggest is that you set up a batch file to run the Putty sftp client and push files and then have your code call the batch file. I'm pretty sure ASP supports calling a batch file.

你在我安 2024-08-16 10:53:32

我有另一个想法。您可以购买 30 美元版本的 WinSCP,它将本地目录与远程 SFTP 目录同步。这会省去你编程的麻烦。

I had another idea. You can buy the $30 version of WinSCP and it will synchronize a local directory with a remote SFTP directory. That would save you the trouble of programming it.

岁月流歌 2024-08-16 10:53:32

You could upload directly to SFTP using a java applet. These applets have hooks to let you (the ASP.NET MVC application) know when the upload is done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文