我想将图像文件保存到服务器文件夹,并将其路径保存到mysql

我想将图像文件保存到服务器文件夹,并将其路径保存到mysql,mysql,Mysql,问题是图像没有移动到UPLOAD_DIR路径,但该文件的路径已成功插入服务器 <?php $con=require_once("connection.php"); define('UPLOAD_DIR', 'http://hpms.hostei.com/images/'); $image= $_REQUEST['image']; //byte image data received $image = str_replace('data:image/png;ba

问题是图像没有移动到UPLOAD_DIR路径,但该文件的路径已成功插入服务器

 <?php
$con=require_once("connection.php");

define('UPLOAD_DIR', 'http://hpms.hostei.com/images/');

$image= $_REQUEST['image'];             //byte image data received
$image = str_replace('data:image/png;base64,', '', $image);
$image = str_replace(' ', '+', $image);
$data = base64_decode($image);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);// 

print $success ? $file : 'Unable to save the file.';


$code=0;
if($r=mysql_query("insert into images values('','$file')"))
{
$code=1;
}


print(json_encode($code));

mysql_close();
?>
你好,阿瓦伊斯·汗·萨尔

You can use the $_FILES server variable. $_REQUEST is used for GET and POST both method 

but you are uploading images i have also this problem and solved with this type. you can 

create post method from any mobile device then save it into folder using 

move_uploaded_file() if any query then tell me, Thanks Hiren kubavat.

亲爱的hiren kubavat,我收到android的字节图像数据。