FTP upload

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Hi All,

I am doing some tests uploading some recorded audio (.3gp) to an FTP server and see if the upload functionality works but I am getting this error "Server returned an error: 553 Could not create file."

I am using this https://www.swfwmd.state.fl.us/data/ftp/ for testing.

It's a small xamarin app and here the url and credentials used. I think it connect fine but cannot upload.
What could be the problem? the file format? or... any other good ftp Server I can test on?

Code:
string FtpUrl = [URL]ftp://ftp.swfwmd.state.fl.us[/URL]; 
string UserName = "anonymous";
string Password = "myemail";
Any help/guidance will be appreciated.
Eric
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Now I am getting the error : "Request timed out"
with the url:
string FtpUrl = "ftp://ftp.swfwmd.state.fl.us/pub/in";
 

wayneh

Joined Sep 9, 2010
18,104
Can you perform the upload using normal FTP software on a computer? I’m just suggesting you eliminate as many variables as you can.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
By the way I am not sure if this is how I should do this! I'm still trying to figure out the right way, ie how to send an audio file together with some other info (name,...) to an ftp server.
 

wayneh

Joined Sep 9, 2010
18,104
I tried using FileZilla to connect but got the attached error after 20 seconds.
Well you obviously need to fix your connection problem before you can test your upload scheme.

If the file format of the file you want to send does not already support metadata, you might consider archiving a small file with the metadata into a zip file with the audio file, and then unzip it at the other end.
 

WBahn

Joined Mar 31, 2012
32,840
How big is the file you are trying to upload? If it is large, try with a very small file using commercial software. If that works (and works with your code) then the problem is somehow related to large files, perhaps exceeding quotas or a connection time limit of some kind. If it doesn't work, then the problem is more fundamental than that, possibly an access privilege or transfer mode issue. If it works with the commercial software but not with your code, then at least part of the problem is with your code.
 

vpoko

Joined Jan 5, 2012
267
Regarding the first error, does the anonymous user have write permissions to the target directory?

Regarding the time-out, are you (the client) behind a firewall or NAT router? FTP has two modes, active and passive. In active mode, the client first establishes a control channel but the server then connects to the client for the data transfer. FTP also supports a passive mode, where the client opens both connections. If you're behind a NAT router or firewall and don't want to mess with port triggering, your best bet is to go passive. See http://slacksite.com/other/ftp.html
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
@WBahn My little app records and upload the file. It's just a few seconds... will measure its size and let you know soon.
@vpoko My app connects to the internet via my router wifi. Yes I have set it to passive.

Here's a bit of code.

Code:
...
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(FtpUrl);
request.Method = WebRequestMethods.Ftp.UploadFile;

request.Credentials = newNetworkCredential(UserName, Password);
request.KeepAlive = true;
request.UseBinary = true;
request.UsePassive = true;
...
Anybody can suggest another free Server I can connect to?

Thanks
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
I found another FTP Server for testing... I been able to connect using FileZilla and now I am testing now with my app.
 

MrSoftware

Joined Oct 29, 2013
2,273
Filezilla will show you the commands that it uses on the console. Also Windows has a built in ftp client (command line) you can use, though I'm not sure off-hand how to tell exactly what commands are being sent behind the scenes...but anyway, try filezilla with verbose logging and look at the commands going back and forth, then see if your software is replicating that. And if not, try to understand the differences.
 

spinnaker

Joined Oct 29, 2009
7,830
Hi All,

I am doing some tests uploading some recorded audio (.3gp) to an FTP server and see if the upload functionality works but I am getting this error "Server returned an error: 553 Could not create file."

I am using this https://www.swfwmd.state.fl.us/data/ftp/ for testing.

It's a small xamarin app and here the url and credentials used. I think it connect fine but cannot upload.
What could be the problem? the file format? or... any other good ftp Server I can test on?

Code:
string FtpUrl = [URL]ftp://ftp.swfwmd.state.fl.us[/URL];
string UserName = "anonymous";
string Password = "myemail";
Any help/guidance will be appreciated.
Eric

Highly likely that anonymous cannot write to the directory.

And Florida would have to be insane if they allowed clear text for file upload. You will likely need to use ftps at the very minimum.
 

spinnaker

Joined Oct 29, 2009
7,830
@WBahn 15 seconds recording id about 32429 Bytes

And now I'm getting the error: Server returned an error: 500 'STOR' not understood

I have never heard of STOR, just looked it up and looks like it is the same a PUT. Try PUT instead of STOR. STOR might not be supported across all platforms. Does not look like it is supported under DOS.
 

spinnaker

Joined Oct 29, 2009
7,830
Top