the commented lines are to a directory on my Mac... on the Mac, this works as expected
on Windows the directory is the CD drive... when I run the program (and click the button that calls this handler) it seems to go through the motion and says it is uploading the files... but if I check on the site there are no files... I walked through it step by step and everything looked correct, but no files...
Code: Select all
on uploadAudio
constant FTPHOST = "ftp.thiswouldbemysite.com"
constant FTPUSER = "ausername"
constant FTPPASS = "1234567890"
--set the itemdelimiter to "/"
--set the defaultfolder to "/Users/pink/Documents/qzqz"
set the itemdelimiter to "\"
set the defaultfolder to "D:\"
put the files into tFileList
repeat for each line zzz in tFileList
set the itemdelimiter to "\"
put zzz into tFileForUpload
put the last item of tFileForUpload into tFileName
put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/" &tFileName into tDestination
libURLSetStatusCallback "UpdateStatus", the long ID of me
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end repeat
end uploadAudio
on uploadComplete pURL, pStatus
answer info pStatus
if pStatus = "uploaded" then
hide scrollbar "ProgressBar"
answer "COMPLETE"
end if
if pStatus = "error" then
hide scrollbar "ProgressBar"
answer "ERROR"
end if
end uploadComplete
on UpdateStatus pUrl, pStatus
set the itemdel to "/"
put last item of pUrl into tFileName
set the itemdel to comma
put empty into tStatusDisplayString
--
switch item 1 of pStatus
-- Handle progress:
case "uploading"
put "Uploading" into tStatusDisplayString
case "loading"
-- Update progress bar:
put item 2 of pStatus into tBytesReceived
put item 3 of pStatus into tTotalBytes
set the endvalue of scrollbar "progressbar" to tTotalBytes
set the thumbpos of scrollbar "progressbar" to tBytesReceived
show scrollbar "progressbar"
--
if tStatusDisplayString is empty then
put "Downloading" into tStatusDisplayString
end if
put cr& tFileName &cr& tBytesReceived& " of "& tTotalBytes after tStatusDisplayString
put tStatusDisplayString into fld "statut2"
break
--
-- Errors:
case "error"
case "timeout"
answer pStatus
exit to top
break
--
-- Completed successfully:
case "uploaded"
--answer "Upload ok"
hide scrollbar "progressbar"
case "downloaded"
hide scrollbar "progressbar"
unload pUrl
break
end switch
end UpdateStatus