Bernard Cheah [MVP] wrote:
> 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/ >
>
> "pbd22" <dushkin@gmail.com> wrote in message
> news:1166381824.609372.300130@73g2000cwn.googlegroups.com...
> >
> > 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
> >