Post by altair on Mar 16, 2015 4:20:05 GMT 10
Hey Guys,
I am new to this FTP stuff. In an application I am creating an app (Private) I would like to know how can I add files to my FTP Server(drivehq). The files I want to add are PDF files. The file has a local copy. And what FTP service do you guys think as the best FTP for free.
Altair - The Flying One
|
|
Post by Prezence on Mar 16, 2015 5:38:05 GMT 10
In my app, CodeLab, you can manage FTP files.
Check out our website here. Check out AirBrowse here. Follow us on GitHub here.
|
|
Post by Nathan Lecompte on Mar 16, 2015 15:31:15 GMT 10
Hey altair , Try FileZilla it's free(open source), powerful and simple to use: filezilla-project.org/Hope this helps!
|
|
Post by altair on Mar 16, 2015 17:37:22 GMT 10
Chris I mean from my app, The generated PDF file from my app should reach the FTP server automaically, I am looking for the code, I found some code in the web. But they are all about text files using StreamReader, I cannot understand how to change the code to send PDF files.
Altair - The Flying One
|
|
Post by Nathan Lecompte on Mar 16, 2015 18:15:23 GMT 10
Yeah, FileZilla should be Open Source, have you checked out the code?
|
|
Post by Nathan Lecompte on Mar 16, 2015 18:16:17 GMT 10
Or you could ask Imformas for help, he made an FTP manager...
|
|
Post by Prezence on Mar 16, 2015 21:12:28 GMT 10
If you search "ftp upload file .net" there are many options. All have to do with sending an FTP web request and getting a response. Here is the code to upload a file: String sourcefilepath = “@absolutepath”; // e.g. “d:/test.docx” String ftpurl = “@ftpurl”; // e.g. ftp://serverip/foldername/foldername String ftpusername = “@ftpusername”; // e.g. username String ftppassword = “@ftppassword”; // e.g. password
private static void UploadFileToFTP(string source) { try { string filename = Path.GetFileName(source); string ftpfullpath = ftpurl; FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath); ftp.Credentials = new NetworkCredential(ftpusername, ftppassword); ftp.KeepAlive = true; ftp.UseBinary = true; ftp.Method = WebRequestMethods.Ftp.UploadFile; FileStream fs = File.OpenRead(source); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); Stream ftpstream = ftp.GetRequestStream(); ftpstream.Write(buffer, 0, buffer.Length); ftpstream.Close(); } catch (Exception ex) { throw ex; } }
Check out our website here. Check out AirBrowse here. Follow us on GitHub here.
|
|
Post by altair on Mar 18, 2015 2:32:15 GMT 10
Not Working,
I translated the code to VB and it throws an exception at (throw ex). Exception is a System.Net.WebException Addititonal Information:- The Request URI is invalid for this command. And by the way I just jumped the FTP hosting service to Byethost.
Altair - The Flying One
|
|
Post by altair on Mar 20, 2015 5:36:58 GMT 10
Guys I would like to have an answer soon. I have a personaly set deadline on 22nd March 2015. So can I know how to do it.
Altair - The Flying One
|
|
Post by Prezence on Mar 20, 2015 10:25:49 GMT 10
You did change the URL and credentials right?
Check out our website here. Check out AirBrowse here. Follow us on GitHub here.
|
|