in the past i have managed to upload image to server (but that was VPS, now im trying with godaddy server).
Heres the code blocks:
https://www.dropbox.com/s/9gndlxibrg8f85b/uploadimage.jpg?dl=0Heres the PHP:
<?php
$ACCESSKEY="uhuh";
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
if($_GET['p']==$ACCESSKEY){
// this is the workaround for file_get_contents(...)
require_once ($_SERVER['DOCUMENT_ROOT'].'/php/PHP_Compat-1.6.0a3/Compat/Function/file_get_contents.php');
$data = php_compat_file_get_contents('php://input');
$filename = $_SERVER['DOCUMENT_ROOT']."/images/".$_GET['filename'];
if (file_put_contents($filename,$data)) {
if (filesize($filename) !=0) {
echo "File transfer completed";
} else {
//header("HTTP/1.0 400 Bad Request");
echo "Error: File is empty.";
}
} else {
//header("HTTP/1.0 400 Bad Request");
echo "Error: File transfer failed.";
}
} else {
//header("HTTP/1.0 400 Bad Request");
echo "Error: Access denied"; //reports if accesskey is wrong
}
?>
When I tried using desktop emulator, it returns error "411: content length required", when i try using connected phone, the filename gets created on the server in right folder too, but the size is always zero and it returns "error transfer failed".
Hope someone can help.