Cordova/Phonegap FileTransfer.upload() error code = 1 (FILE_NOT_FOUND_ERR)
Date : March 29 2020, 07:55 AM
should help you out Serverside script was wrong... naturally I should have figured that out given the obvious FileTransferError.FILE_NOT_FOUND_ERR error message. Apologies for wasting everyone's time and thank you for making the effort.
|
Cordova fileTransfer works perfect on iOS, throws error code = 1 on Android
Date : March 29 2020, 07:55 AM
it helps some times I'm developing a mobile app for iOS and Android using Cordova and Ionic Framework. There needs to be 'Send Photo' and related functionality, and I'm using Cordova's FileTransfer to do this. , Maybe late but I've kinda fixed it. In my view file I use: <input id="file" name="file" type="file" onchange="angular.element(this).scope().addFile(this)" class="upload" accept="image/*" capture="camera"/>
$scope.addFile = function(item){
function uploadComplete(evt) {
/* This event is raised when the server send back a response */
$scope.imgId = JSON.parse(evt.target.responseText).data;
$scope.$apply();
$http.post($rootScope.baseServerUrl + 'Members/changeAvatar', {attachment_id: $scope.imgId}).success( function (response){
console.log(response);
$scope.User.attachment_id = $scope.imgId;
$scope.$apply();
});
}
function uploadFailed(evt) {
alert("There was an error attempting to upload the file.")
};
var updateImage = function (element) {
$scope.$apply(function() {
$scope.theFile = element.files[0];
var formData = new FormData();
formData.append("file", $scope.theFile);
var xhr = new XMLHttpRequest()
xhr.addEventListener("load", uploadComplete, false)
xhr.addEventListener("error", uploadFailed, false)
xhr.open("POST", $scope.baseServerUrl + "media/Attachments/add")
xhr.setRequestHeader("Accept","application/json")
$scope.progressVisible = true
xhr.send(formData);
});
};
updateImage(item)
}
|
Cordova's FileTransfer Writing Error (Code 1)
Date : March 29 2020, 07:55 AM
wish of those help The problem was caused by an upgrade of Cordova from a previous version. The path of local files was not properly identified: .fullPathis now obsolete and should be replaced by .toURL().
|
Cordova Android Filetransfer returning null
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Turns out this was that kit kat version bug that was happening for a while. i restricted my version of android to 21, and all my woes went away. thank you @aorfever for your answer, it is exactly what i was doing, but ended up being something out side of the actual functions i was calling that was the issue!
|
File upload error code 1 in ng-cordova filetransfer plugin
Date : March 29 2020, 07:55 AM
will help you Finally this simple solution works for me. UPDATE After Changing the Code in App controller and Webapi Controller Every thing working like a charm and images are start saving on server via API. uploadOptions.httpMethod = "POST";
uploadOptions.headers = {
Connection:"close"
};
var httpPostedFile = HttpContext.Current.Request.Files["file"];
|