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 #184758 is a reply to message #184757] Thu, 30 January 2014 11:31 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior 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

> <?php
>
> print_r($_FILES);

If the $_FILES array is empty at this point, the the possibilities that
come to mind are:

1) Your javascript is broken
2) Something is blocking the file upload
3) A webserver configuration issue (see 2)

Have you tried using a very simple html form based upload instead? That's
a lot simpler to code in html than all that javascript, and should at
least enable you to verify that it is (or is not) possible to transfer
files from the browser to the server.

<html>
<head>
<title>test upload</title>
</head>
<body>
<form enctype="multipart/form-data" action="" method="POST">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
<pre>
<?php
if ( isset( $_FILES['userfile'] ) )
print_r( $_FILES );
else
echo "Nothing";
?>
</pre>
</body>
</html>

I assume that https://testserver.com/FileUpload/upload_file.php is a url
that you have crafted to conceal the actual url, otherwise you might want
to change it to the actual webserver url you are using.

I have no idea what the purpose of the js to set options.mimeType to 10
or so different values one after the other is - but it ends up as "video/
ogg" - if this is meant to be the mimetype of the uploaded file then the
method of determining and setting it appears flawed.

In fact I have no idea what most of the js is meant to do, and if the
above mentioned php test proves that the simple file upload from your
browser to your server is working, I suggest you find a phonegap forum
for more specific assistance with your problem.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[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: Wed Nov 27 12:02:07 GMT 2024

Total time taken to generate the page: 0.04645 seconds