Please Help: I Think I Am Sending The File Name, Not The Actual File




hi.

could somebody look at my below code and explain to me if i am passing
the "full path" of the
file to be uploaded to the FTP server, or just the file name? i keep
getting "cannot find file" errors
when i try to upload. on the FTP server side, i always get an empty
file (0 kb) with the appropriate file name uploaded to the ftp folder.

if i am just passing the file name, and not the correct path, could
somebody explain to me what code i need to change below to send the
actual file instead of the name of the file?

thanks in advance.
peter

ps - my file count is usually correct, so we are good there.

Dim ftpClient As New Code.clsFTP("192.168.0.100", "", "anonymous",
Context.User.Identity.Name, 21)

If (ftpClient.Login() = True) Then

'Create a new folder
ftpClient.CreateDirectory("FTPFOLDERNEW")

'Set our new folder as our active directory
ftpClient.ChangeDirectory("FTPFOLDERNEW")

'Set FTP mode
ftpClient.SetBinaryMode(True)

Dim myfiles As System.Web.HttpFileCollection =
System.Web.HttpContext.Current.Request.Files

Dim iFile As Integer

For iFile = 0 To myfiles.Count - 1
' get the posted file
Dim postedFile As System.Web.HttpPostedFile =
myfiles(iFile)

'make sure it is not blank
If Not postedFile.FileName.Equals("") Then
'Upload a file from your local hard disk to the FTP
site.

ftpClient.UploadFile(System.IO.Path.GetFileName(postedFile.FileName))
End If

Next iFile

'Always close the connection to make sure that there are
not any not-in-use FTP connections.
'Check to see if you are logged on to the FTP server and
then close the connection.
'ftpClient.CloseConnection()

End If

.



Relevant Pages

  • Re: Single Logon
    ... upload command to upload files ... which implement those basic FTP verbs. ... |> components will retrieve a ServicePoint(which represent a connection to ... |> | private void DownloadFile(string strFilename, string strAddress, ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Silly query !
    ... The UpLoad Speed of a typical ADSL Connection is usually around about ... Connection Speeds - a Byte is normally 8 bits, ... YouSendit.com Server?) ... WebSpace, using FTP? ...
    (uk.people.silversurfers)
  • Re: Can you use an FTP program with dial-up???
    ... > of them mention that they support FTP as opposed to BROWSER support. ... Yes you can use FTP upload to your web site if the host supports FTP, ... Since both methods involve use of the same connection from your ...
    (alt.html)
  • PHP File Upload Fails
    ... I am trying to do a FTP file upload which works fine on my localhost but on ... my ISP server it fails. ... // set up basic connection ...
    (comp.lang.php)
  • Re: Publisher and 1&1
    ... In other words, clean up the folder. ... change the FTP proxy settings to allow ... To use Publisher read the following ... this is your root directory and where you upload your Publisher ...
    (microsoft.public.publisher.webdesign)