J
JGBNS via DotNetMonster.com
Hi,
I am new to this forumand I apologize as i am not a .net programmer but we
have a program being developed by a .net programmer. Nowwe have run into an
ftp snag and I think it is part ftp and part .net coding.
Heres the issue..
We have an image directory full of photos like 200,000 in it, and if you use
an ftp client to ftp to the site and then navagate to that file it will try
to read it / open it. Well of course it will time out and I understand that.
Now if i drag an image from my PC in the ftp client and drop it on top the
folder with the images it saves it there fine no error or timeout.
So our program will be uploading images to this dir and we need to have it
save the image to this dir and not open or read it just save the file to it.
Below is the code being used for the image upload and it still times out it
is obvious it is trying to read the file first.
Two questions is there an alternate way to ftp, a different command maybe..
Or better yet another way to get images from the users computer using this
program to our server??
Open to all ideas willing to pay for a fix / work around.
Code below and other forums we posted this on please review all data and
other forums we have put this on perl forums because our site uses perl, .net
forums, and ftp forums..
Please help us:
code
Friend Sub ftpfile()
Dim sFTPSrcFileName As String
Dim sFTPTgtFileName As String
' For testing purpose we have hard-coded the input file
sFTPSrcFileName = "D:\446224_2_thumb.jpg"
sFTPTgtFileName = "sample1.jpg"
Dim sURL As String
sURL = "ftp://ftp.mysite.com"
Inet1.Protocol = icFTP
Inet1.RequestTimeout = 60
Inet1.RemotePort = 21
Inet1.AccessType = icDirect
Inet1.URL = "ftp://ftp.mysite.com"
Inet1.UserName = "myusername"
Inet1.Password = "mypassword"
Inet1.Execute , "PUT" & sFTPSrcFileName & " " &
"/httpdocs/myfile/images/imgupld/" &sFTPTgtFileName
Me.WaitForResponse
Inet1.Execute sURL, "CLOSE"
Me.WaitForResponse
End Sub
Friend Sub WaitForResponse()
Dim fWait As Boolean
On Error GoTo ErrHandler
fWait = True
Do Until fWait = False
DoEvents
fWait = Inet1.StillExecuting
Loop
ErrHandler:
Err.Clear
End Sub
Private Sub Command1_Click()
Form1.ftpfile
Timer1.Enabled = True
Set Form1 = Nothing
Unload Me
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error Resume Next
Select Case State
Case icNone
Case icResolvingHost: Me.lblRESPONSE.Caption = "Resolving Host"
Case icHostResolved: Me.lblRESPONSE.Caption = "Host Resolved"
Case icConnecting: Me.lblRESPONSE.Caption = "Connecting..."
Case icConnected: Me.lblRESPONSE.Caption = "Connected"
Case icResponseReceived: Me.lblRESPONSE.Caption = "Transferring File..."
Case icDisconnecting: Me.lblRESPONSE.Caption = "Disconnecting..."
Case icDisconnected: Me.lblRESPONSE.Caption = "Disconnected"
Case icError: MsgBox "Error:" & Inet1.ResponseCode & " " & Inet1.ResponseInfo
Case icResponseCompleted: Me.lblRESPONSE.Caption = "Process Complete."
End Select
Me.lblRESPONSE.Refresh
Err.Clear
End Sub
I am new to this forumand I apologize as i am not a .net programmer but we
have a program being developed by a .net programmer. Nowwe have run into an
ftp snag and I think it is part ftp and part .net coding.
Heres the issue..
We have an image directory full of photos like 200,000 in it, and if you use
an ftp client to ftp to the site and then navagate to that file it will try
to read it / open it. Well of course it will time out and I understand that.
Now if i drag an image from my PC in the ftp client and drop it on top the
folder with the images it saves it there fine no error or timeout.
So our program will be uploading images to this dir and we need to have it
save the image to this dir and not open or read it just save the file to it.
Below is the code being used for the image upload and it still times out it
is obvious it is trying to read the file first.
Two questions is there an alternate way to ftp, a different command maybe..
Or better yet another way to get images from the users computer using this
program to our server??
Open to all ideas willing to pay for a fix / work around.
Code below and other forums we posted this on please review all data and
other forums we have put this on perl forums because our site uses perl, .net
forums, and ftp forums..
Please help us:
code
Friend Sub ftpfile()
Dim sFTPSrcFileName As String
Dim sFTPTgtFileName As String
' For testing purpose we have hard-coded the input file
sFTPSrcFileName = "D:\446224_2_thumb.jpg"
sFTPTgtFileName = "sample1.jpg"
Dim sURL As String
sURL = "ftp://ftp.mysite.com"
Inet1.Protocol = icFTP
Inet1.RequestTimeout = 60
Inet1.RemotePort = 21
Inet1.AccessType = icDirect
Inet1.URL = "ftp://ftp.mysite.com"
Inet1.UserName = "myusername"
Inet1.Password = "mypassword"
Inet1.Execute , "PUT" & sFTPSrcFileName & " " &
"/httpdocs/myfile/images/imgupld/" &sFTPTgtFileName
Me.WaitForResponse
Inet1.Execute sURL, "CLOSE"
Me.WaitForResponse
End Sub
Friend Sub WaitForResponse()
Dim fWait As Boolean
On Error GoTo ErrHandler
fWait = True
Do Until fWait = False
DoEvents
fWait = Inet1.StillExecuting
Loop
ErrHandler:
Err.Clear
End Sub
Private Sub Command1_Click()
Form1.ftpfile
Timer1.Enabled = True
Set Form1 = Nothing
Unload Me
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error Resume Next
Select Case State
Case icNone
Case icResolvingHost: Me.lblRESPONSE.Caption = "Resolving Host"
Case icHostResolved: Me.lblRESPONSE.Caption = "Host Resolved"
Case icConnecting: Me.lblRESPONSE.Caption = "Connecting..."
Case icConnected: Me.lblRESPONSE.Caption = "Connected"
Case icResponseReceived: Me.lblRESPONSE.Caption = "Transferring File..."
Case icDisconnecting: Me.lblRESPONSE.Caption = "Disconnecting..."
Case icDisconnected: Me.lblRESPONSE.Caption = "Disconnected"
Case icError: MsgBox "Error:" & Inet1.ResponseCode & " " & Inet1.ResponseInfo
Case icResponseCompleted: Me.lblRESPONSE.Caption = "Process Complete."
End Select
Me.lblRESPONSE.Refresh
Err.Clear
End Sub