我该如何编写代码以便我可以浏览ftp来选择要下载的文件 [英] How should I write my code so that I can browse ftp to select the file for download

查看:92
本文介绍了我该如何编写代码以便我可以浏览ftp来选择要下载的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是.NET的新手。我正在尝试从ftp上传和下载文件。我可以上传,但问题是我想在ftp文件夹中显示当前文件,以便用户可以选择要下载的文件。我应该怎么做???



提前谢谢

解决方案

你必须连接到FTP,然后获取所有文件和文件夹信息。然后在网格或其他东西的UI上显示它们。



您可以为每个文件设置一个下载按钮。您可以使用代码如何:使用FTP下载文件 [ ^ ]获取响应流。然后将流转换为字节数组并分配给Response对象以便在浏览器中下载。



我找到了一个类似概念的例子 - 基于Web的FTP客户端 [ ^ ]。但我不保证,如果它能工作与否。



但是你可以使用相同的逻辑来使其适用于一些研究。

Hi,

I'm new to .NET. I am trying to upload to and download files from ftp. I am able to upload but the problem here is I want to show the present files in the ftp folder so that the user can select the file to download. How should I do it???

Thanks in advance

解决方案

You have to connect to the FTP, then get all files and folder info. Then show them on UI in a Grid or something.

You can have a download button for each file. You can use the code How to: Download Files with FTP[^] for getting the response stream. Then convert the stream to byte array and assign to the Response object for downloading in browser.

I found one example with similar concept - A web based FTP client[^]. But I don't guarantee, if it would work or not.

But you can work on the same logic to make it work with a little bit of research.


这篇关于我该如何编写代码以便我可以浏览ftp来选择要下载的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆