I have some trouble with uploading file to ftp server
I have trouble with uploading file to my ftp server in my Android device, in Editor it working perfect. Plz help me with it !!!
try
{
string filename = Path.GetFileName(/* local file path */);
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(/ link to file in my server */);
ftp.Credentials = new NetworkCredential(username_ftp, password_ftp);
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream fs = File.OpenRead(/* local file path */);
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;
}
Answer by mmehrten · Jul 15, 2016 at 10:40 PM
I'm not really sure what you're asking... What's the problem?
Answer by trantnt1093 · Nov 22, 2016 at 04:07 AM
it just work fine on development build and when you build release ftp request don't have connection.
Answer by Kesaria · Apr 01, 2017 at 08:54 AM
Hi,
Sorry for late reply. You can try this @trantnt1093 Use FtpWebRequest.Open instead of FtpWebRequest.Create.
Your answer

Follow this Question
Related Questions
My first game published made with unity 0 Answers
C# safe connect to MySQL database. Download and upload data via PHP script. 1 Answer
Loop animation by script without turning on loop on Animation Inspector 0 Answers
how can i use my phone's camera as a webcam and let unity recognize it as a connected webcam? 0 Answers
How to close IAP or how to Quit App properly Android 2 Answers