Please Help: I Think I Am Sending The File Name, Not The Actual File
- From: "pbd22" <dushkin@xxxxxxxxx>
- Date: 17 Dec 2006 10:57:04 -0800
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
.
- Follow-Ups:
- Re: Please Help: I Think I Am Sending The File Name, Not The Actual File
- From: Bernard Cheah [MVP]
- Re: Please Help: I Think I Am Sending The File Name, Not The Actual File
- Prev by Date: Re: FTP User Isolation with IIS 5.0
- Next by Date: Re: cannot connect to FTP
- Previous by thread: FTP User Isolation with IIS 5.0
- Next by thread: Re: Please Help: I Think I Am Sending The File Name, Not The Actual File
- Index(es):
Relevant Pages
|