[
https://issues.apache.org/jira/browse/CB-12392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
jcesarmobile closed CB-12392.
-----------------------------
Resolution: Won't Fix
The plugin has been deprecated and this won't be fixed.
Read the blog post about the alternatives
https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html
> [android] file-transfer uploads 13 bytes less than total
> --------------------------------------------------------
>
> Key: CB-12392
> URL: https://issues.apache.org/jira/browse/CB-12392
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-file-transfer (DEPRECATED)
> Environment: Samsung j5, Android 5.0,
> [email protected]
> Reporter: Sergey Shakhnazarov
> Priority: Major
>
> Reported on Slack
> File transfer plugin uploads the file content 13bytes less the total size of
> the file:
> {code}
> document.addEventListener('deviceready',DeviceReady, false);
> var image = document.getElementById("image");
> var upload = document.getElementById("upload");
> var showing = document.getElementById("showing");
> function DeviceReady(){
> console.log("trying out the camera things here");
> }
> //this function is invoked when the user clicks the button
> function getImage(){
> image.style.display="none";
> navigator.camera.getPicture(
> onSuccess,
> onFail,
> {
> quality: 100,
> destinationType:navigator.camera.DestinationType.FILE_URI,
> sourceType:
> navigator.camera.PictureSourceType.PHOTOLIBRARY
> });
> }
> function onSuccess(imageURI){
> image.src=imageURI;
> image.style.display="block";
> var serverUrl = encodeURI("http://192.168.43.146/filetransfer");
> var options = new FileUploadOptions();
> options.fileKey="file";
> options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
> options.mimeType="image/jpeg";
> var params = new Object();
> params.value1 = "test";
> params.value2 = "param";
> options.params = params;
> options.chunkedMode = false;
> options.multipartMode = true;
> var ft = new FileTransfer();
> ft.onprogress = function(progressEvent) {
> if (progressEvent.lengthComputable) {
> showing.innerHTML = (progressEvent.loaded /
> progressEvent.total)*100;
> } else {
> loadingStatus.increment();
> }
> };
> ft.upload(imageURI, serverUrl, onUploadSuccess, onUploadError,
> options, true);
> }
> function onFail(message){
> showing.innerHTML = "showing image failed "+ message;
> }
> function onUploadSuccess(r){
> showing.innerHTML = "Uploaded successfully";
> showing.innerHTML = "Code = " + r.responseCode +"Response =
> " + r.response+ "Sent = " + r.bytesSent;
> }
> function onUploadError(){
> showing.innerHTML = "Error uploading file";
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]