student
student

Reputation: 179

Could not create path to save downloaded file - Ionic iOS

I am trying to release an application written in Ionic Cordova but I face a problem with one of the functionalities of the app. Especially, there is a button where you download a file which works perfect in the android version, but in iOS I get this error:

FileTransferError { body = "Could not create path to save downloaded file: The file \U201c\U201d couldn\U2019t be saved."; code = 1; "http_status" = 200; source = "https://player.vimeo.com/external/221750072.sd.mp4?s=4dd5a5319a2484a715c54f58ef5b0e53&profile_id=165&download=1"; target = "null.CHURCHOF%20SAINT%20JOHN.mp4"; } File Transfer Error: Could not create path to save downloaded file: The file “” couldn’t be saved.

Upvotes: 1

Views: 2125

Answers (1)

Juan Miguel S.
Juan Miguel S.

Reputation: 601

How are you making the destination path? It seems that some propertie you are using is null, so you should modify it in order to get a valid destination path. For instance, I use for this purpose an structure like:

var destPath = (cordova.file.externalDataDirectory || cordova.file.dataDirectory) 
               + "path_to_destination"

And then the fileTransfer plugin:

var ft = new FileTransfer();
ft.download(url, destPath, success, error, true);

Upvotes: 3

Related Questions