Trying to get a progress bar working for a ftp upload
Posted: Thu Jul 28, 2011 7:33 pm
Yes, I watched the controls training and studied the progress bar part very carefully. I cannot extrapolate what I need from it in this case.
The user needs to upload files to the file server and I thought a progress bar would make a nice touch.
Here is the code that uploads the ftp files and FTPs.
=================================
-- was invisible, now show it.
show the sb "prgScrollBar"
set the startvalue of sb "prgScrollBar" to 1
# 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
put empty into field "fldRef1"
# Connect the start the upload
local tDestination
put "http://www." & "travelandworkusa.com" &FilePath &tFileName into tFieldDest
put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "ftp.travelandworkusa.com" &FilePath & tFileName into tDestination
libURLSetStatusCallback "uploadProgress", the long ID of me
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
put tFieldDest into field "fldRef1"
end mouseUp
on uploadComplete pURL, pStatus
put "Status Update:" && pStatus && return after field "lblHints"
set the thumbpos of sb "prgScrollBar" to xyz
end uploadComplete
on uploadProgress pURL, pStatus
put "Status Update:" && pStatus && return before field "lblHints"
set the thumbpos of sb "prgScrollBar" to xyz
end uploadProgress
=========================================
Is this line
set the thumbpos of sb "prgScrollBar" to xyz
in the right place and how do I 'plug it in' to the value of the ftp upload?
I need to figure out the end position of the progress bar by finding out the total size of the file being uploaded - how do I do this?
Mike
The user needs to upload files to the file server and I thought a progress bar would make a nice touch.
Here is the code that uploads the ftp files and FTPs.
=================================
-- was invisible, now show it.
show the sb "prgScrollBar"
set the startvalue of sb "prgScrollBar" to 1
# 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
put empty into field "fldRef1"
# Connect the start the upload
local tDestination
put "http://www." & "travelandworkusa.com" &FilePath &tFileName into tFieldDest
put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "ftp.travelandworkusa.com" &FilePath & tFileName into tDestination
libURLSetStatusCallback "uploadProgress", the long ID of me
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
put tFieldDest into field "fldRef1"
end mouseUp
on uploadComplete pURL, pStatus
put "Status Update:" && pStatus && return after field "lblHints"
set the thumbpos of sb "prgScrollBar" to xyz
end uploadComplete
on uploadProgress pURL, pStatus
put "Status Update:" && pStatus && return before field "lblHints"
set the thumbpos of sb "prgScrollBar" to xyz
end uploadProgress
=========================================
Is this line
set the thumbpos of sb "prgScrollBar" to xyz
in the right place and how do I 'plug it in' to the value of the ftp upload?
I need to figure out the end position of the progress bar by finding out the total size of the file being uploaded - how do I do this?
Mike