FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Phonegap upload issue with PHP server
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Phonegap upload issue with PHP server [message #184760 is a reply to message #184757] Fri, 31 January 2014 12:55 Go to previous message
JohnT is currently offline  JohnT
Messages: 16
Registered: April 2011
Karma:
Junior Member
On Thu, 30 Jan 2014 02:48:17 -0800, Saikat Saha wrote:

> Hi, I am using the below phonegap code to upload my file to remote PHP
> server and I am able to upload the file even I am getting response 200
> ok but on the PHP server my file is not getting received even the array
> is empty, I don't know PHP coding while my friend can't able to figure
> out the issue in PHP code,could anyone please help me out with the
> required PHP code we had tried every possible steps.
>

Battled with this a few months ago.
Here are the magic runes that worked for me:


var url = [PATH TO SERVER];
var imageURI = [PATH TO FILE]

var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType = [FILE MIME TYPE];
// This header is a workaround for an Android bug that causes every
// second upload to hang
options.headers={'Connection':'close'};
var params = {};
params.token = this.accessToken;
options.params = params;
var ft = new FileTransfer();
ft.onprogress = mediauploadprogress;
ft.upload(imageURI, encodeURI(url), mediauploadsuccess, mediauploadfail,
options);


JohnT
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: help with preg_match pattern
Next Topic: Writing double-prime to file?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 00:05:47 GMT 2024

Total time taken to generate the page: 0.04401 seconds