XWidgetSoft Forum
https://xwidget.com/bbs/

Help "Downloading image"
https://xwidget.com/bbs/viewtopic.php?f=8&t=4597
Page 1 of 1

Author:  kabott1 [ May 27th, 2014, 4:23 pm ]
Post subject:  Help "Downloading image"

hey, im trying to make a daylight map widget, how do i pharse and automatically download an image (jpg, bmp, gif) to a destination folder?

Author:  hamid [ May 27th, 2014, 10:36 pm ]
Post subject:  Re: Help "Downloading image"

there is a function available for this:

==========

Code:
DownloadFile("","","")

the parameters are as follow:
1. url: the url where you want to download from
2. FileName: the path and file name where you want to store the file
3. FunctionName: the function which should be run after the download completed (you can use this to use the downloaded file), you must fill this parameter with a function name to function work

==========

the FunctionName that will be called after download completed
will have these parameters:
Code:
function dlCompleteExample(p1,p2,p3)

p1: will indicate that the download is succeeded (true) or failed (false)
p2: will store the path to the file
p3: will get the size of the file

Notes:
1. you can use your own FunctionName
2. you can use your own parameter names as variable instead of p1,p2,p3
3. using of parameters is optional

==============

example:
Code:
function widgetOnLoad()
{
   DownloadFile("http://bbs.xwidget.com/styles/subsilver2/imageset/site_logo.gif",WidgetPath+"download_test.gif","dlComplete")
}

function dlComplete(stat,fpath,fsize)
{
   print("status: "+stat)
   print("file path: "+fpath)
   print("file size: "+fsize)
}


================

more info can be found here:
http://bbs.xwidget.com/viewtopic.php?f=8&t=1966
http://bbs.xwidget.com/viewtopic.php?f=8&t=3632

================

Author:  meme [ May 28th, 2014, 12:43 am ]
Post subject:  Re: Help "Downloading image"

Great reply hamid :mrgreen:

Author:  kabott1 [ May 28th, 2014, 6:54 am ]
Post subject:  Re: Help "Downloading image"

Thank you hamid! :D

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/