Code Monkey home page Code Monkey logo

Comments (11)

ShaunBrassell avatar ShaunBrassell commented on May 23, 2024 2

I have the same issue on Android running Ionic. I have a podcast application that downloads episodes, and although most work well, some podcasts return a success, but have a file size of 0 bytes. Both links are downloadable in the browser though.

Example of good URL: https://www.listennotes.com/e/p/54bb560d1a9e4ac1836662ee2c469030/

Example of 0 byte issue: https://www.listennotes.com/e/p/8685f19b77874283a0b6e159eb7024ea/

UPDATE - 31 Jan 2022

I solved my issue on Android. I tested today on IOS, which worked fine, and since the above links work on a browser, I had a deeper look at Android. Both above links have redirects, which is handled fine by IOS. Turns out that Android java redirects using HttpURLConnection only work when the redirect protocol remains the same over each hop i.e. all http, or all https (by design, apparently for security reasons). In my case, the 'bad url' had multiple redirects, with a mix of protocols. So it stops when the protocol changes, and hence the file you download is the 302 redirect page where it changed, and hence you get a successful download, but with a file that is 0 bytes.

My workaround is to add some code that manually follows the directs.

from cordova-plugin-file-transfer.

breautek avatar breautek commented on May 23, 2024

Use the error callback to determine if there was an error that occurred. If so, please include that information.

from cordova-plugin-file-transfer.

breautek avatar breautek commented on May 23, 2024

Also please do not remove the bug template. It's there for a reason and filling out the form properly will give us much more information about your environment. So do please edit your question and fill it out.

from cordova-plugin-file-transfer.

sachinbasendr avatar sachinbasendr commented on May 23, 2024

Hi @breautek
There are no any error occurred in callback, i got success callback function

My environments
cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.3
ionic (Ionic CLI) : 3.20.1

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.2.0
Cordova Platforms  : android 7.1.4
Ionic Framework    : ionic-angular 3.9.9

System:

Android SDK Tools : 26.1.1
Node              : v10.16.3
npm               : 6.9.0 
OS                : Linux 4.15

Environment Variables:

ANDROID_HOME : /home/flitwebs/Android/Sdk

Misc:

backend : pro

Thanks for the reply @breautek .

from cordova-plugin-file-transfer.

sachinbasendr avatar sachinbasendr commented on May 23, 2024

Hello @breautek ,

I just use download URL server from any other source then it was successfully downloaded with correct size.
So u can tell me what was wrong with my download server URL.

Thanks @breautek Please help

from cordova-plugin-file-transfer.

breautek avatar breautek commented on May 23, 2024

So u can tell me what was wrong with my download server URL.

That's going to be really hard to answer. Could be the server sending incorrect Content-Type or Content-Length, the server could be running into an error and not sending the entire file, etc. The possibilities is endless... If the problem is indeed with your server, you'll have to login to it and look at the logging information, or update the server to produce debugging output, etc.

from cordova-plugin-file-transfer.

ibesoft11 avatar ibesoft11 commented on May 23, 2024

@sachinbasendr How are you serving the file from your server? If you are doing it via a pipe, then it might not work (from what I've noticed). You may have to send the complete file at once.
Maybe if you can show your server code, I might be able to help out.
Cheers

from cordova-plugin-file-transfer.

GioviQ avatar GioviQ commented on May 23, 2024

I have the same issue with a Cordova app for iOS tested on iPhone XR 13.3.1

The server returns the correct Content-Type and Content-Lenght.

I tried all examples here https://cordova.apache.org/docs/en/6.x/reference/cordova-plugin-file-transfer/index.html and always I received successful result, but file is 0 KB.
File trasfer in fact is too fast to complete, it does not wait for file generation on server.

Something related to https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html ?

Installed platforms:
ios 5.1.1

Plugins
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-opener2 3.0.0 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine"

from cordova-plugin-file-transfer.

OFMaurice avatar OFMaurice commented on May 23, 2024

I have the same problem. On android it's working fine but on IOS the downloaded file has 0 Bytes size using the same http service to download the file. Anybody has a solution?

from cordova-plugin-file-transfer.

OFMaurice avatar OFMaurice commented on May 23, 2024

I have the same problem. On android it's working fine but on IOS the downloaded file has 0 Bytes size using the same http service to download the file. Anybody has a solution?

I found the problem on IOS my cookies are not sent with the download request

from cordova-plugin-file-transfer.

malgee012 avatar malgee012 commented on May 23, 2024

I also encountered this problem, how to solve it?

from cordova-plugin-file-transfer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.