Can't upload file using jqt and php

21 views
Skip to first unread message

Colin Earle

unread,
May 11, 2014, 10:57:24 PM5/11/14
to jqt...@googlegroups.com
I can get this working using a standard web page, but when I try to do the same thing in jqt it fails.

I want to be able to take a photo from a mobile phone and email it to a fixed (support) email address. I can do the emailing at the host using php, just need to get the image to the server.

html code:
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="uploadedfile" accept="image/*" capture="camera">
<br>
<input type="submit" value="Upload">
</form>
php code:
<?php 
$target_path = "upload/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!<br>";
}
?>

error_log:
[12-May-2014 00:39:32 Australia/Melbourne] PHP Notice:  Undefined index: uploadedfile in /***/upload.php on line 4
[12-May-2014 00:39:32 Australia/Melbourne] PHP Notice:  Undefined index: uploadedfile in /***/upload.php on line 6


I found this, but it's not making any difference.

jQTouch attempts to submit forms via Ajax by default... Could you try setting "formSelector" to false on init?


I assume this is set in the header like this:
<script type = "text/javascript" charset="utf-8"> 
$.jQTouch({
icon: 'jqtouch.png',
statusBar: 'black-translucent',
preloadImages: [],
formSelector: false
});
</script>

But this has not made any difference.

Can someone please help?



Reply all
Reply to author
Forward
0 new messages