all groups > iis ftp > december 2006 >
You're in the

iis ftp

group:

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


Please Help: I Think I Am Sending The File Name, Not The Actual File pbd22
12/17/2006 10:57:04 AM
iis ftp:

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
Re: Please Help: I Think I Am Sending The File Name, Not The Actual File Bernard Cheah [MVP]
12/18/2006 12:00:00 AM
Try post it to developer newsgroup. This is pure coding issue.

--
Regards,
Bernard Cheah
http://www.iis.net/
http://www.iis-resources.com/
http://msmvps.com/blogs/bernard/


[quoted text, click to view]

Re: Please Help: I Think I Am Sending The File Name, Not The Actual File pbd22
12/18/2006 7:44:16 AM
ok, thanks

[quoted text, click to view]
AddThis Social Bookmark Button