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
Developer
ingvar_e
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor

Re: File download problems

Tried the one you sent.

 

Got a bit further.  Got a text on screen  

 

Home: /webworksBB10/com.peardox.FSTestIm/home

 

then 

Cannot read property fullpath of undefined

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: File download problems

Comment out the lines after dodownload in onInitFs

 

Or try the new one




Click the like button if you find my posts useful!
Please use plain text.
Developer
ingvar_e
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor

Re: File download problems

That was the one you sent that I tried.  Lines already where commented out

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Please use plain text.
Developer
ingvar_e
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor

Re: File download problems

I found the JS extension for file download på Github.

 

I created a folder "ext" on the same level as config.xml and downloaded the  jar file "blackberry.io.filetransfer"

I updated the config file with

 

    <feature id="blackberry.io.filetransfer" required="false" version="1.0.0.0"/>
    <access subdomains="false" uri="file:///"/>   

 

I tried thiscode

 

function DL()
 {
// Here whe need to create the local folder, if it doesn't exist already
    if (!blackberry.io.dir.exists("file:///store/home/user/logos/"))
     {
        blackberry.io.dir
                .createNewDir("file:///store/home/user/logos/");
     }
    
    // Download the file
    //blackberry.io.filetransfer.download
    //webworks.io.FileDownloader.download
      webworks.io.filetransfer.download
    (
       {
        url: "https://www.google.com/images/srpr/logo3w.png",     // the image url
        type : 'GET',                                            // explicitly setting method type to 'GET'
        dest: "file:///store/home/user/logos/GoogleLogo.png",    // the local file
        success : function(data)
         {                                // The function called after the file is downloaded
            alert('success');
         },
        error : function(data)
          {                                        // The function called if something fails
            alert('error:'+data);
          }
       }
    )
 }
 

there where 3 different suggestions on how to name the called routine and I tried all

 

Uncaught TypeError: Cannot read property 'dir' of undefined

 

links:

https://github.com/dbotelho/blackberry.io.filetransfer

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Download-Image-From-URL-Link-And...

 

 

 

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Please use plain text.