FTP Programming Question




Hi.

I have an FTP programming question.
I want the total size of a file being uploaded "before" it is
completely uploaded to the server. I need this for the condition:
when currentbytes = totalbytes, do something. But,
it seems that the filesize before it hits the FTP server is not equal
to the same file's bytes on the other end. I am using either of the
two methods to get the filesize "before" it lands on the remote
server:

Dim postedFile As HttpPostedFile = myfiles(count)
postedFile.InputStream.Length

-- or --

postedFile.ContentLength

and the below method to get the filesize once it is on the FTP server
(and fully uploaded):

Public Function GetFileSize(ByVal sFileName As String) As Long

If (Not (m_bLoggedIn)) Then
Login()
End If

SendCommand(("SIZE " + sFileName))

Dim size As Long = 0

If (m_iRetValue = 213) Then
size = Int64.Parse(m_sReply.Substring(4))
Else
Throw New IOException(m_sReply.Substring(4))
End If

Return size

End Function

Does anybody see why this could be happening? Has anybody else noticed
this distinction?

Thanks in advance.

.



Relevant Pages

  • Help with IPFW + NATD + Passive FTP
    ... passive FTP connections through IPFW with NATD enabled. ... $cmd 005 allow all from any to any via dc0 ... # Interface facing Public internet ... # Allow out access to my ISP's Domain name server. ...
    (freebsd-questions)
  • RE: Client Computers cannot upload or download from Remote FTP ser
    ... SBS External NIC - Cannot FTP From this server ... SBS Internal NIC ... FTP server is Checked in Routing and Remote Access - Internet Connection - ...
    (microsoft.public.windows.server.sbs)
  • RE: Client Computers cannot upload or download from Remote FTP ser
    ... Only FTP via the MS DOS FTP Client ... The server that works is a member of the SBS's Domain, BUT as I indicated, ... the router, not the SBS server. ... The client event log has nothing related logged. ...
    (microsoft.public.windows.server.sbs)
  • Re: IIS 6.0 FTP
    ... That's the point I'm making--you are testing the wrong server. ... your FTP server is ftp.kilduff.com. ... than IIS? ... I understand your have the order entry program, ...
    (microsoft.public.inetserver.iis.ftp)
  • Re: Is this a 3-Leg Perimeter scenario?
    ... Do you mean the FTP server is hosted on the ... to control the traffic to not go though ISA but go to SmoothWall directly. ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)