fileName = "test.txt";
uploadURL = ip + "/uploadmobile.cfm"; // I tested this and this works
via regular HTML form
//the same ip works properly for AJAX calls
uploadFile(fileName, uploadURL);
function uploadFile(fileName, uploadURL) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=fileName;
options.mimeType="text/plain";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
alert("test5");
//FAILS here with error code 2 (security_err) ///the same ip works
properly for AJAX calls
ft.upload(fileName, uploadURL, win, fail, options);
alert("test6");
}
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
I don't know.
I created the file in a previous step: saveFile(fileName, contents)
(see below)
I'm not sure where that goes.
I have decided to work around the whole thing since I don't really
need a file. I am changing it to an AJAX call that POSTs the data that
would have been in the file.
But if I ever need this...it would be nice to know how to get the full
path to the file that I created.
function saveFile(fileName, contents) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSystem) {
fileSystem.root.getFile(fileName, {create: true, exclusive: false},
function(fileEntry){
fileEntry.createWriter(function(writer){
writer.onwrite = function(evt) {
alert("write success");
};
writer.write(contents);
} , fail); //createWriter
}, fail); //getFile
}, fail); //requestFileSystem
}
On Dec 14, 3:04 pm, Drew Walters <deedu...@gmail.com> wrote:
> Where does the "test.txt" file actually exist on the file system? Its
> likely failing because the file cannot be found. You should try to
> use the file protocol ("file://") and specify the full path to the
> file. I've added code to automatically prefix the file protocol if
> not specified but its not available in the code you are using.
>
fileSystem.root.getFile(fileName,
So your created file should be at fileSystem.root.fullPath + "/" + fileName