Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860
Accepted Solution

Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Hi,

 

I want to download image from URL link and store the image in local folder in Webworks BB10.
But I didn't got code for this.

If any one know such code or having any solution then please help me....

Thanks & Regards,

Nitish Subudhi
 

Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

[ Edited ]

Try working with the WebWorks API documentation to get some pieces of source code to start working with the APIs. The easiest way to create a file download in BB10 is the new FileTransfer API and there is an example in the docs to get started.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Hi LBP,

can u please suggest me the code of file transfer for BB6 webworks..
I am working on a project in which i have to download the image to local folder and save the path in SQL database...
And i am checking the project in 9800 OS6.
Please help me...

Thanks & regards,

Nitish Subudhi 

Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

For BB SmartPhone OS 6/7 or PlayBook OS have a closer look to the WebWorks Community APIs, they created some great extensions to work with FileTransfer (FileDownload, FileUpload) almost the same way BB10 is working by default right now. The only difference between them using the extensions from WebWorks Community APIs seem to be the object the functionality for download files is assigned to. For SmartPhone/PB using the extension it is:

 

webworks.io.filetransfer

 and using BB10 it is:

 

blackberry.io.filetransfer

 

Give it a try. I already worked with BB10 FileTransfer API and also using it for PlayBook and it worked quite well so far for the simple use cases.

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Hi LBP,
I go through this code.....but it is throwing exception. i.e " ReferenceError: Webworks is not defined ".

please suggest me how to fix this problem..

Thanks & regards,
Nitish Subudhi
Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks


NitishSubudhi wrote:
I go through this code.....but it is throwing exception. i.e " ReferenceError: Webworks is not defined ".

Depending on the device/OS you need to add the extension to your WebWorks installation like explained there for BB SmartPhone OS or for PlayBook OS.

 

For usage read the samples provided, they should work in any way. When I was working with the extension on PlayBook I only copy+pasted the provided sample source code and changed the attributes for the function call:

 

// You need to define "remotePath", "localPath", "onProgress", "onError", "options" like shown in documentation
blackberry.io.fileTransfer.downloadFile(remotePath, localPath, onProgress, onError, options);

For BB SmartPhone OS the function call looks like this:

 

// You need to define "options" like shown in documentation
webworks.io.FileDownloader.download(options);

All think all informations provide there, try to follow and it should work.

 

 

 

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Trusted Contributor
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Thanks a lot LBP....
the above code is working fine....
Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Good to know it was a solution for you! :smileyhappy:


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
New Developer
Posts: 7
Registered: ‎10-29-2012
My Device: 9780
My Carrier: etisalat

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Hi LBP,

 

I am using ripple emulator to test my app, but it is throwing exception. i.e " ReferenceError: Webworks is not defined ".

I go through the document but still i coudn't fix it.

 

Platform: Webworks version 2.0

 

Regards,

Sundaram

 

Developer
Posts: 29
Registered: ‎09-17-2012
My Device: 9810, 9800, 9700, 9900, 9300
My Carrier: BSNL

Re: Download Image From URL Link And Store The Image In Local Folder In BB10 Webworks

Hi sundaram,
The above code didn't work in ripple.... you have to check your code in the simulator.. for which you have to set the sdCard path.

Thanks & Regards,
Himansu

Thanks & Regards,
Nitish_Pheonix

Hit like if the above post is helpful to you.
Please Accept this as Solution if the above post is a solution for you.