Comments (11)
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.
Use the error callback to determine if there was an error that occurred. If so, please include that information.
from cordova-plugin-file-transfer.
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.
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.
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.
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.
@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.
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.
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.
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.
I also encountered this problem, how to solve it?
from cordova-plugin-file-transfer.
Related Issues (20)
- Server issue: Cordova flie-transfer-plugin working on UAT server but not on Production server
- cordova-plugin-file-transfer is not working with cordova 11 HOT 2
- cordova plugin add cordova-plugin-file-transfer Not working HOT 2
- Compatibility with cordova-plugin-file@7 Android URLs HOT 14
- This plugin seems to be no longer supported HOT 1
- Cordova 11 > Android incompatible HOT 15
- With iOS, I think -file-transfer needs to be updated to work with -plugin-file v7 HOT 3
- how do i install 2.0.0-dev? HOT 1
- EPERM (Operation not permitted) HOT 1
- cordova-plugin-file-transfer is not working with ios HOT 2
- Longer downloads fail silently when app is backgrounded on iOS HOT 1
- Kindly advise if there is an alternative to FileTransfer / FileUpload for use with Capacitor 4. Thanks HOT 3
- Upload was not working in API level 32 in Android HOT 2
- Can't resolve 'cordova-plugin-file-transfer' HOT 1
- Undeprecate this plugin HOT 4
- The plugin 2.0.0-dev will not load on Android 6.0 and below. HOT 2
- Getting code 1 file exists on file download HOT 8
- `download` method failing on cordova / android platform with `java.lang.NullPointerException` exception HOT 6
- open failed: ENOENT (No such file or directory) HOT 2
- There is any way to download image from POST API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-file-transfer.