FtpDLX - LoopItem not changing values - WeOnlyDo Discussion board

FtpDLX - LoopItem not changing values (wodSFTP / wodSFTP.NET / wodSFTPdll)

by jenn5175, Monday, February 05, 2007, 22:08 (6312 days ago)

I am using clientside VBScript to FTP from an ASP page. Everything works good, except I need to change the filenames as they are being uploaded, as well as skip anything that is not a JPG file. I thought I found sample code to do this within the LoopItem function, but it isn't working.

[code]
Sub bUpload_OnClick
wodFtpDLX1.Protocol = < =sProtocol >
wodFtpDLX1.Hostname = < =sHostname >
wodFtpDLX1.Login = < =sLogin >
wodFtpDLX1.Password = < =sPassword >
wodFtpDLX1.Port = < =sPort >
wodFtpDLX1.RemotePath = < =sRemotePath >
wodFtpDLX1.Blocking = true
wodFtpDLX1.Passive = false
wodFtpDLX1.Connect
wodFtpDLX1.PutFiles sLocalpath.value, < =sRemoteDir >
wodFtpDLX1.Disconnect

sUploadedFiles.value = sUploadedFiles.value & iFileCount & Files Uploaded
End Sub

Sub wodFtpDLX1_LoopItem(LocalFile, RemoteFile, ItemType, Skip)
If ucase(Right(RemoteFile, 4)) = ucase( .jpg ) Then
sPath = Right(RemoteFile, len(RemoteFile) - inStrRev(RemoteFile, / ))
RemoteFile = < =sRemoteDir >< =iClientID >_< =iProgramID >_ & iEventID.value & _ & sPath
sUploadedFiles.value = sUploadedFiles.value & Uploading: & RemoteFile & VbCrLf & VbCrLf
iFileCount = iFileCount+1
Skip = False
Else
Skip = True
End If
End Sub
[/code]

iFileCount correctly displays only the number of JPGs (so getting in the If/Else) but all files are uploaded - regardless of me setting Skip = True if not a JPG.

Also, the new value of RemoteFile displays correctly in the textarea (sUploadedFiles) but when the file is actually FTP'd, it come sover as its old name (the one on the local machine, not the one defined in LoopItem).

I tried to switch it to non-blocking and listen for events instead but it kept hanging, so I went back to this blocking version.

What am I missing?
Jenn

Re: FtpDLX - LoopItem not changing values

by wodDamir, Monday, February 05, 2007, 22:28 (6312 days ago) @ jenn5175

Hi Jennifer,

As I already responded to you on our ticketing system, this is a limitation in VBScript. You won't be able to use the LoopItem Event for this. Modifying RemoteFile or Skip parametar won't make any difference.

I would suggest finding another way to do this. You could upload each file separately using GetFile Method, and modify the RemotePath parametar for each file accordingly.

Regards,
Damba