FTP 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 Upload

Post by PeterG » Mon Oct 28, 2013 7:20 pm

Hi Guys
I would really appreciate it if someone could just tell me what is wrong with my code.
I am pretty sure my ftp address, username amd password is correct because I am using it on a daily bases.
When running the test I get "Status Update: error "

Code: Select all

constant FTPHOST = "ftp.An IP address"
constant FTPUSER = "my user"
constant FTPPASS = "my passowrd"

on mouseUp
    # Start by getting the file to upload
    local tFileForUpload, tFileName
    answer file "Select a file to upload"
    put it into tFileForUpload
    
    # Get the name of the file for upload
    set the itemdel to "/"
    put the last item of tFileForUpload into tFileName
    put empty into field 1
    
    # Connect the start the upload
    local tDestination
    put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "/gagsoft/" & tFileName into tDestination
    libURLSetStatusCallback "uploadProgress", the long ID of me
    libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end mouseUp

on uploadComplete pURL, pStatus
    put "Status Update:" && pStatus && return after field 1
end uploadComplete

on uploadProgress pURL, pStatus
    put "Status Update:" && pStatus && return before field 1
end uploadProgress
:?

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

Re: FTP Upload

Post by bangkok » Mon Oct 28, 2013 8:02 pm

gagsoft wrote:

Code: Select all

    put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "/gagsoft/" & tFileName into tDestination
You forgot... FTPHOST !

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

Re: FTP Upload

Post by PeterG » Mon Oct 28, 2013 8:29 pm

Hi
Thanks for the pointer.
I am still getting the following error:

Code: Select all

Status Update: connecting 
Status Update: error 
after changing the code:

Code: Select all

put "ftp://41.204.205.166" & FTPUSER & ":" & FTPPASS & "@" & "/gagsoft/" & tFileName into tDestination

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

Re: FTP Upload

Post by bangkok » Mon Oct 28, 2013 8:56 pm

I'm afraid that you have now... the wrong order.

Host is coming after user and password.

Look at the dictionnary :

get URL "ftp://john:passwd@ftp.example.net:2121/picture.jpg"
1. The string "ftp://"
2. An optional user name and password, separated by a colon (:) and followed by "@"
3. The name of the server
4. An optional port number preceded by a colon (:)
5. The name and location of a file or directory, starting with a slash (/)

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

Re: FTP Upload

Post by PeterG » Wed Oct 30, 2013 8:06 am

Hi
Thanks for this help.
It is working now.
Much appreciated

Peter G

Post Reply