Hello,
I want to try httpjob postfile method to post a file to my server using php. On b4i side I use :
On php side I tried a sample php code from a google search
I always get possible file upload attack from the php as a result. Is there any working php side example for a simple postfile method with a few lines of codes like this ? or can anyone who understand from php tell me what is wrong with this ?
TY
I want to try httpjob postfile method to post a file to my server using php. On b4i side I use :
B4X:
Dim ds As HttpJob
ds.Initialize("ds",Me)
ds.PostFile("http://server/FileUpload2.php",File.DirDocuments,"tufan.jpg")
On php side I tried a sample php code from a google search
B4X:
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
I always get possible file upload attack from the php as a result. Is there any working php side example for a simple postfile method with a few lines of codes like this ? or can anyone who understand from php tell me what is wrong with this ?
TY