Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

network.download() used to download file from Google Drive or Dropbox is not working
Started by BK PANARA Jan 08 2020 09:31 PM

4 replies to this topic
google drive dropbox network.download
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

BK PANARA

[GLOBAL: userInfoPane.html]
BK PANARA
  • Enthusiast

  • 79 posts
  • Corona SDK

Hello Guys,

I am trying to download a file from Google Drive and Dropbox.

1. I upload my PNG file to Google Drive OR Dropbox 
2. click share and create public download link
3. Now I have public URL to download the file

I have used below code :

local function networkListener( event )
    if ( event.isError ) then
        print( "Network error - download failed: ", event.response )
    elseif ( event.phase == "began" ) then
        print( "Progress Phase: began" )
    elseif ( event.phase == "ended" ) then
        print( "Displaying response image file" )
        myImage = display.newImage( event.response.filename, event.response.baseDirectory, 60, 40 )
        myImage.alpha = 0
        transition.to( myImage, { alpha=1.0 } )
    end
end 
local params = {}
params.progress = true
 
network.download(
    "PUBLIC URL from Google Drive OR Dropbox",
    "GET",
    networkListener,
    params,
    "helloCopy.png",
    system.TemporaryDirectory
)

-- I can see a message in console that "helloCopy.png" is not a valid image file.

--> When I used this url : "http://docs.coronalabs.com/images/simulator/image-mask-base2.png"
it's working.

 

-- I have tried same code to download a zip file also and then I tried to uncompress zip file manually on my Mac. (Error : unsupported file  screenshot)

Please help me regards this , what I can't download files from google drive and dropbox public link ?

Thank you.
Bhavin

 



[TOPIC: post.html]
#2

Michael Flad

[GLOBAL: userInfoPane.html]
Michael Flad
  • Contributor

  • 270 posts
  • Corona SDK

I haven't done/used this myself, but here's some info/code you may give a try.

 

https://forums.coronalabs.com/topic/73687-whats-the-easiest-cloud-solution-to-use/

https://gist.github.com/HoraceBury/dd46914c0449da7e14cb380dc05766aa



[TOPIC: post.html]
#3

BK PANARA

[GLOBAL: userInfoPane.html]
BK PANARA
  • Enthusiast

  • 79 posts
  • Corona SDK

Hi @Michael Flad,

Thanks for your reply but.
I am working on the App which require to import zip file to import data.
So any user will upload zip file where it can be share for public (for example. Google Drive , Dropbox or any other)
To import I will download the file from the user provided : it can be google drive file public url or dropbox public link.

I know that if I download file from my server then it will work , but I can't be sure where user will upload the file.
Why file formate becomes unsupported after download from Google Drive or dropbox ?

Thanks again.

 



[TOPIC: post.html]
#4

BK PANARA

[GLOBAL: userInfoPane.html]
BK PANARA
  • Enthusiast

  • 79 posts
  • Corona SDK

I think I understand the issue with Dropbox and Google Drive.

I am not sure but I think the public link will return the HTML page that show's download option there (you can check dropbox public link in your browser and see what it shows on the page) , So definitely this is not our file in the public link response.

is there any website that provide direct download link ?



[TOPIC: post.html]
#5

jdsmedeirosbr

[GLOBAL: userInfoPane.html]
jdsmedeirosbr
  • Enthusiast

  • 98 posts
  • Corona SDK

See if that helps you ...
 



[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: google drive, dropbox, network.download