4
I need to download txt files that are on an FTP, I tried to use the following repackaged code below for this but it does not do what I need.
The first parameter of the Downloadfile method is the URL I have, the second parameter is required but I don’t want to set a fixed path and I want it to take the original name of the file.
I want the download to be done the same when you download a file such as this site: https://jquery.com/download/ through the Google Chrome
Someone please knows how it can be done?
string url = "http://MeuSite/arquivo.text";
using (WebClient wc = new WebClient())
{
wc.DownloadFile(url, "Não sei o que colocar aqui");
}
Thank you all.
I do not understand very well what you want to do. It is possible to give a more detailed explanation in the question?
– Jéf Bueno
if I’m not mistaken the first parameter of the Downloadfile method is the url, and the second is the file name
– jbrunoxd
It’s simple, I have a grid with a list of files that are on FTP to download, when the user click to download a file he has to download to the user’s machine. Enter this jquery link and download it using Google’s browser, that’s exactly what I need. You got it?
– Mauricio Ferraz
Oh yes, I got it. I hadn’t seen the tag [tag:Asp.net]. Its only problem is what you want to take the original file name to save to the client, right?
– Jéf Bueno
Right, but I don’t want to set a fixed path, I want it to do the same as Chrome by downloading the file and saving in the user’s download folder logged in the machine.
– Mauricio Ferraz
@Mauricioferraz posts his solution as answer, then you can accept it as solution and the question will not go unanswered. :)
– Pedro Camara Junior