且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net 4.0中上载文件夹并显示包含文件并使用Progressbar上载ftp

更新时间:2023-02-11 09:29:07

您拥有这首音乐,使用服务器的所有人也都拥有吗?

您无法在ASP.NET中做您想做的事情.您需要使用Flash或Java或.NET或C ++编写控件,将其托管在您的页面中,并让它们执行这些操作. HTML无法执行您列出的任何操作.它无法执行FTP,无法浏览或选择文件夹,并且无法显示进度栏.
You own this music, and so does everyone using your server ?

You can''t do what you want in ASP.NET. You need to write a control in flash or java or .NET or C++, host it in your page, and have it do these things. HTML can''t do anything you listed. It can''t do FTP, it can;t browse or choose folders, and it can''t show a progress bar.


您所能做的就是上传文件集(但而不是目录).上传文件后,可以使用ASP.NET服务器端代码将它们进一步移动.例如,对于FTP,将System.Net.WebRequest与URI的FTP类型一起使用.请求的运行时类型为System.Net.FtpWebRequest,将通过工厂方法System.Net.WebRequest.Create基于URL创建.

在此处查看一些示例代码: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx [ ^ ].

另请参阅: http://msdn.microsoft.com/en-us/library/system .net.webrequest.aspx [ ^ ].

我认为您无法使用进度条来跟踪客户端中文件上传的进度.据我所知,HTTP服务器将HTTP文件上传视为一个一步的过程,不会通知您.我也从未在网站上看到这种行为.进度条是相当可行的,但恐怕无法显示相关状态.

—SA
All you can do is uploading set of files (but not a directory) using HTTP. When the files are uploaded, you can move them further using ASP.NET server-side code. For FTP, for example, use System.Net.WebRequest with FTP type of URI. The run-time type of request will be System.Net.FtpWebRequest, it will be created based on URL via the factory method System.Net.WebRequest.Create.

See some sample codes here: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

See also: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].

I don''t think you can use a progress bar to track the progress of file upload in the client side. To best of my knowledge, HTTP servers treat HTTP file upload as a one-step process giving you no notification. I also never saw such behavior on Web sites. A progress bar is quite doable, but I afraid showing relevant status in it is not possible.

—SA