Scodigo, Inc.

Log In | Register

Cart Items:
0

PHP Copy (a visual alternative)

Hi,
I am using smart pill to make an updater for our filemaker solutions. It's using php to check a webservice to see if a newer version of some datafiles and a user interface file have been updated.

if the webservice returns true, i want to give the user the option to download the updates. at the moment i am using

PHP copy $link = $lookup->
Link; $path = FM_DESKTOP_PATH;
$path .= $File;

copy($link, $path);

however if i start to put large files on the updater, it can take a while for these to copy. this approach has no visual element to let the user know it is downloading in the background.

does any one know of a better way to do this

Many Thanks
Craig Walker

file details

Hi again, i am looking into sprucing up this code,

do you know of a way i can get the details of the file size and give the user the option to cancel the download if it takes to long.

Cheers
Craig

ps thanks for the earlier reply and for the plugin

file details

Micah Woods's picture

Hello Craig,

If you have FTP access, you could connect to the server and get the file size. If you only have HTTP access, I think you may be able to get the file size by reading header info. I haven't done this myself but did a quick search and found something that may work here:

http://snipplr.com/view/29/get-remote-filesize/

Regards,
Micah

thats perfect, i didnt read

thats perfect, i didnt read the manual properly, should have seen the 0 iterations part for the barber pole. just need to test with some bigger files for the timeouts

many thanks,
Craig

Take a look at the progress bar functions

Micah Woods's picture

Hello Craig,

Take a look at the progress bar functions (p. 46 in the manual). You can display a "barber pole" type progress bar with a message regarding the files that are being downloaded.

When downloading large files, you'll want to adjust the timeout for the call to PHP_Execute and you'll want to use fm_progress_bar_timeout to extend the timeout for the progress bar as well.

Regards,
Micah