Upload Drama

sgietz

Member
Joined
Jan 10, 2008
Messages
10
Programming Experience
3-5
I'm trying to upload a file and it's driving me bonkers!! :(

I looked at code all over the net and I just can't get it to work. Here's my code:

VB.NET:
Dim s As String = Trim(txtFile.Text)
Dim fname As String = Microsoft.VisualBasic.Right(s, InStr(StrReverse(s), "\") - 1)
  Try
    My.Computer.Network.UploadFile(s, <myftpserver> & fname, <username>, <password>)
  Catch ex As Exception
    MessageBox.Show(ex.Message)
  End Try
I'm getting either a 404, or 550 error. Sometimes the file uploads as a zero bit file, but never actually fully arrives. What am I doing wrong? Could this be a firewall issue? :confused:
 
Last edited:
No, all that checks out. Here's what I'm getting. Let's say I upload a file named "test.jpg" to the server, I can see it on the server, but it's zero bit, meaning it started uploading, but then stopped. It never finishes. To me, this sounds like a firewall issue, because the same thing happens when downloading blocked files (blocked on our network here). I didn't know it would block both directions. Am I on to something, or is it my code? Apparently it is connecting and at least attempting to upload files.
 
ftp command and ftp data actually operates on two different "channels" so if you can actually make the connection and then it drop afterward then yes, the firewall is the culprit.

this normally has to be fixed on the server itself... if it's a hardware firewall you might need to get your network admin involve.

i'll follow up with a link to a really good article about this later.
 
Back
Top