Ftp woes

Dave Cragg dcragg at lacscentre.co.uk
Mon Apr 22 16:04:00 EDT 2002


At 4:10 pm -0400 22/4/02, Tim wrote:
>Hi, I¹m having difficulties compressing and uploading a stack to my
>FTP server. Here¹s the code:
>
>
>on mouseUp
>   save stack "TestStack"
>   put "PowerBookHD/Revolution Projects/TestStack.rev" into \
>tLocalFile --TestStack is a Revolution Stack containing 3 other substacks
>   put compress(tLocalFile) into URL
>"ftp://myusername@domain.com:mypassword@ftp.business.earthlink.net/www/TestStack"
>   close stack "TestStack"
>end mouseUp
>

Two problems:

1.  with the file data (need to use "url" syntax)
2.  with the user name (need to urlEncode because of the "@" character)


put "/PowerBookHD/Revolution Projects/TestStack.rev" into tLocalFile
put "myusername at domain.com" into tName
put "ftp://" & urlEncode(tName) & ":mypassword" & "@" into tUrl
put "ftp.business.earthlink.net/www/TestStack" after tUrl
put url ("binfile:" & tLocalFile) into tData
put compress(tData) into url tUrl
if the result is not empty then
   answer the result ##error check
end if

If the password contains any "funny" characters, you should urlEncode 
that too. (but not the ":" separating the name and password)

Cheers
Dave Cragg



More information about the use-livecode mailing list