File – Error code 5, encoding_err

I want to save the image from the ios application to the gallery so that the user can share it.

My application uses ionic framework & ngCordova. I I want to save the image like this:

image = cordova.file.applicationDirectory + "www/img/deck/" + card.image; 
file_path = cordova.file. documentsDirectory + "wisdom.png";
$cordovaFile.createFile(file_path, true).then(function(result) {
alert(JSON.stringify(result));
}, function (err) {
alert('create error: '+ JSON.stringify(err));
});
$cordovaFile.writeFile(file_path, image).then(function(result ) {
alert(JSON.stringify(result));
}, function(error) {
alert(JSON.stringify(err));
});

When creating the file, this will give error code 5, ENCODING_ERR. Writing the file will not give a success or failure error. There is no image in the gallery. What should be the path to save the file? How should I send the image to the write method? Why do I receive an encoding error?

I encountered the same error and have found a solution. You may no longer need it , But someone is looking for it.

Add the following line to the configuration:



The file url is also It should start with file: ///...

I want to save the image from the ios application to the gallery so that users can share it.

< p>My application uses ionic framework & ngCordova. I want to save images like this:

image = cordova.file.applicationDirectory + "www/img/deck/" + card .image; 
file_path = cordova.file.documentsDirectory + "wisdom.png";
$cordovaFile.createFile(file_path, true).then(function(result) {
alert(JSON. stringify(result));
}, function(err) {
alert('create error: '+ JSON.stringify(err));
});
$cordovaFile .writeFile(file_path, image).then(function(result) {
alert(JSON.stringify(result));
}, function(error) {
alert(JSON.stringify(err));
});

When creating the file, this will give error code 5, ENCODING_ERR. Writing a file will not give a success or failure error. There is no image in the gallery. What should be the path to save the file? How should I send the image to the write method? Why do I receive an encoding error?

I encountered the same error and have found a solution. You may no longer need it, but someone is looking for it.

Add the following line to the configuration:



File URL should also start with file: ///...

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3789 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.