Corallino
Corallino

Reputation: 109

phonegap file transfer with space in the file name

I'm using Cordova 1.9.0 for an Android App. The same code, on IOS works fine. On Android, i find a problem for the file trasfert from remote location to local. The problem is on the file name: someone has space. I try to do

.replace(" ","%20")

but doesn't work. It gives me the following error

07-03 12:06:32.503: E/FileTransfer(337): java.io.FileNotFoundException: http://www.mydomain.com/sa02 -.jpg

Upvotes: 0

Views: 2067

Answers (3)

Terryng
Terryng

Reputation: 1

PhoneGap 1.9.0 and 2.0.0 break fileTransfer.download() for names with spaces. The workaround for now until PhoneGap 2.1.0 comes out is

var source = encodeURI(file path here);
source = source.replace(/%/g,"%25");

Upvotes: 0

Thomas V J
Thomas V J

Reputation: 658

url = url.replace(/ /g,"%20");

Upvotes: 0

Simon MacDonald
Simon MacDonald

Reputation: 23273

There was a bug in FileTransfer upload which a fix was checked in for 1.9.0.

https://issues.apache.org/jira/browse/CB-978

Upvotes: 1

Related Questions