How To Use Input Type File In Phonegap?
How to use html file attribute in phonegap ? so that i can browse any .txt file from my android device and upload it to the server?? I read file transfer method in phonegap documen
Solution 1:
You can't use input file on Phonegap. It's not supported. You need make something like this:
functionuploadDatabase(callback) {
// file.entry accessible from global scope; see other tutorialvar filepath = file.entry.fullPath,
uploadOptions = newFileUploadOptions(),
transfer = newFileTransfer(),
endpoint = "http://facepath.com/payload";
uploadOptions.fileKey = "db";
uploadOptions.fileName = "database.db";
uploadOptions.mimeType = "text/plain";
transfer.upload(filepath, endpoint, transferComplete,
transferError, uploadOptions);
}
in mime type put the type of file
Solution 2:
I wrote this answer "You can't use input file on Phonegap. It's not supported.". Check the solution on https://stackoverflow.com/a/13862151/1853864
Post a Comment for "How To Use Input Type File In Phonegap?"