Page 1 of 1

FTP file Upload

Posted: Fri Sep 13, 2013 10:57 am
by PeterG
Hi All
I tried the FTP file upload eaxample on
http://lessons.runrev.com/s/lessons/m/4 ... -using-ftp
This is the code:
constant FTPHOST = "My_FTP_Address"
constant FTPUSER = "My_User"
constant FTPPASS = "My_Password"

on mouseUp
# Start by getting the file to upload
local tFileForUpload
answer file "Select a file to upload"
put it into tFileForUpload

# Get the name of the file for upload
local tFileName
set the itemdel to "/"
put the last item of tFileForUpload into tFileName

# Connect the start the upload
local tDestination
put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "ftp.41.204.205.172/gagsoft/" & tFileName into tDestination
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end mouseUp
on uploadComplete pURL, pStatus
put "Status Update:" && pStatus && return after field 1
end uploadComplete
When I apply it, it does not yield any errors and does not do anything
But when I run it, it says the following:
"Button": execution error at line 22 (Chunk: no such object) near "1", char 47
Also is there a way to test if the FTP connection is working?

Thanks
Peter G

Re: FTP file Upload

Posted: Fri Sep 13, 2013 1:00 pm
by bangkok
gagsoft wrote: "Button": execution error at line 22 (Chunk: no such object) near "1", char 47
Have you checked ? Does the field 1 exist ?

Give it a real name, or use ID, to be sure.

Re: FTP file Upload

Posted: Fri Sep 13, 2013 4:18 pm
by PeterG
Hi Thanks

I updated the label but now it gives me an status update error in Field1

Thanks
Peter G

Re: FTP file Upload

Posted: Fri Sep 13, 2013 6:53 pm
by bangkok
It means you're making progress !

What is the "error message" ?

Re: FTP file Upload

Posted: Sun Sep 15, 2013 12:59 pm
by PeterG
Upload_Error.jpg
Status update error
Upload_Error.jpg (9.12 KiB) Viewed 4769 times
This is what it shows after selecting a file for upload.

Thanks
Peter G

Re: FTP file Upload

Posted: Sun Sep 15, 2013 1:08 pm
by SparkOut
Not checked but in the line

Code: Select all

put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "ftp.41.204.205.172/gagsoft/" & tFileName into tDestination
do you really need the ftp. after the @ and before the IP address? You've already given the determination that it's ftp protocol at the start of the string before the username and password. I don't think you're resolving a server address "ftp.41.204.205.172" so it's failing there.