Comments (4)
Are you sure you're using the upload
api? For upload, the http method is forced to either PUT
or POST
.
See:
cordova-plugin-file-transfer/www/FileTransfer.js
Lines 127 to 131 in dc8fbd7
from cordova-plugin-file-transfer.
@breautek Certain. This is my code:
this.fileTransfer.upload(imageData, encodeURI(url.replace('https', 'http') + 'pages/attachments.php'), options).then(data => {
console.log(data);
}, error => {
console.log(error);
});
from cordova-plugin-file-transfer.
On my app, I'm using version 1.7.2-dev
, and it appears to work for me, at least for iOS and android. I have my own fork, and I am 4 commits behind Apache's master.
Note that this plugin is deprecated so there won't be any new releases or PRs merged in.
If you open up your project in Xcode (platforms/ios/) or Android Studio (platforms/android/), you should be able to set breakpoints to ensure the requests are being sent as a POST
request from the native code.
from cordova-plugin-file-transfer.
Hi @breautek
Can you please suggest me the way how to add requestBody in fileTransfer plugin.
I am adding it in params but it is not working giving error as "Missing fields are required"
FileTransferError {code: 1, source: "content://com.android.providers.media.documents/document/document%3A33", target: "http://192.168.1.6:9001/protected/", http_status: 400, body: "<?xml version="1.0" encoding="UTF-8"?>↵<Error><Cod…34ec-b728-4fb5-a2fb-1beb859876db</HostId></Error>", …}body: "<?xml version="1.0" encoding="UTF-8"?>↵<Error><Code>MissingFields</Code><Message>Missing fields in request.</Message><BucketName>protected</BucketName><Resource>/protected/</Resource><RequestId>168FD184D26AB3F2</RequestId><HostId>f83934ec-b728-4fb5-a2fb-1beb859876db</HostId></Error>"code: 1exception: "http://192.168.1.6:9001/protected/"http_status: 400source: "content://com.android.providers.media.documents/document/document%3A33"target: "http://192.168.1.6:9001/protected/"__proto__: Object
let options: FileUploadOptions = {
fileKey: 'file',
fileName: res[0].filename,
httpMethod: res[0].http_method,
params: requestBodyObj,
chunkedMode: false
};
this.fileTransfer
.upload(filePath, encodeURI(res[0].upload_url), options)
.then(
data => {
console.log(data);
},
err => {
console.log(err);
}
);
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.