I have issues with uploading multiple files to a server by ftp.
put 1 into counter
repeat with i = 1 to the number of items in ftplist
put false into success
put item i of ftplist into fileName
put "ftp://myserver.mydomain.com/uploads/" & counter into theURL
libURLftpUploadFile fileName, theURL
wait for n seconds
repeat with i = 1 to 120
wait for 0.5 seconds
put URLStatus(theURL) into theURLStatus
if theURLStatus = "uploaded" then
put true into success
exit repeat
end if
end repeat
reportOnFTPSuccess(success)
end repeat
If I debug this and step thorugh it line by line then it works and the files get uploaded with URLStatus returning "uploaded". If I run it with no debugging then URLStatus either returns "connecting" or "" (ie nothing).
Any ideas?
Anyone written something easy to use that ftp's synchronously?
libURLftpUploadFile & URLStatus
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 1236
- Joined: Sat Apr 08, 2006 1:10 pm
- Location: Zurich
- Contact:
liburlftpuploadfile is asynchronous.
Untested example, which does something similar to your code:
Untested example, which does something similar to your code:
Code: Select all
on mouseUp
put 1 into counter
repeat for each item fileName in ftplist
--you'll get problems when there are itemdelimiters in your filepaths why not use lines?
add one to counter
put "ftp://myserver.mydomain.com/uploads/" & counter into theURL
libURLftpUploadFile fileName, theURL, "uploadFinished"
end repeat
end mouseUp
on uploadFinished theURL, theStatus
if theStatus <> "uploaded" then
put "Error: Status" && theStatus && "reported with URL:" && theURL & return after msg
end if
end uploadFinished
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode