FTP file Upload

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
PeterG
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

FTP file Upload

Post by PeterG » Fri Sep 13, 2013 10:57 am

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

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: FTP file Upload

Post by bangkok » Fri Sep 13, 2013 1:00 pm

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.

PeterG
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: FTP file Upload

Post by PeterG » Fri Sep 13, 2013 4:18 pm

Hi Thanks

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

Thanks
Peter G

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: FTP file Upload

Post by bangkok » Fri Sep 13, 2013 6:53 pm

It means you're making progress !

What is the "error message" ?

PeterG
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: FTP file Upload

Post by PeterG » Sun Sep 15, 2013 12:59 pm

Upload_Error.jpg
Status update error
Upload_Error.jpg (9.12 KiB) Viewed 4764 times
This is what it shows after selecting a file for upload.

Thanks
Peter G

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: FTP file Upload

Post by SparkOut » Sun Sep 15, 2013 1:08 pm

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.

Post Reply