简体   繁体   English

在C#中使用进度条在FTP服务器中上传文件

[英]Upload file in FTP server by using progress bar with C#

I have to upload a huge file in FTP server and using progress bar. 我必须在FTP服务器上上传一个巨大的文件,并使用进度条。

How can i perform this without using any third free components? 我如何在不使用任何第三个免费组件的情况下执行此操作?

Best regards. 最好的祝福。

You can get a code to specify the size of the file already in the server and bind it to a timer. 您可以获取代码以指定服务器中已经存在的文件大小,并将其绑定到计时器。 Then, based on the file size of the file being uploaded, you will be able to deduce the size already uploaded. 然后,基于要上传的文件的文件大小,您将能够推断出已经上传的文件大小。

I'll get you the code, but I'd suggest you get them on separate threads as they will slow down the system considerably. 我将为您提供代码,但建议您将它们放在单独的线程上,因为它们会大大降低系统速度。

You can't do this proper only with plain ASP.NET. 您只能使用纯ASP.NET才能正确执行此操作。 For the state of the progress bar you'll need some JavaScrip/AJAX action or a Flash object. 对于进度条的状态,您将需要一些JavaScrip / AJAX操作或Flash对象。 If you don't want to go with a free 3rd party component, you need to write it by yourself. 如果您不想使用免费的第三方组件,则需要自己编写。 There's no build-in ASP.NET functionality. 没有内置的ASP.NET功能。

Update 更新资料

Since the use of AJAX is a possibility for you, this article might be interesting: 由于您可以使用AJAX,因此本文可能会很有趣:

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM