我正在开发一个Android应用程序,用于机场客户抱怨住宿和跟踪。用户将输入他们的乘客ID,抱怨文本和图像(可选)...我正在使用异步Http客户端库将图像上传到服务器...
上传图片的客户端代码是 -
File myfile=new File(photoFile.getAbsolutePath());
params.put("image",myfile);
我正在将相机拍摄的图像保存在photoFile中。 然后我发出POST请求并发送投诉ID(在客户端生成),投诉文本和图像到服务器。
在服务器端我使用PHP,代码就是这样 -
$complain_id=$_POST['complain_id'];
$ticket_id=substr($complain_id,-6);
$complain=$_POST['complain_text'];
$imageName = $_FILES["image"]["name"];
move_uploaded_file($_FILES["image"]["tmp_name"] , "/images/".$imageName);
$imageData = file_get_contents( "/images/".$imageName);
$imageData = addslashes($imageData);
$imageType = $_FILES["image"]["type"];
$sql='INSERT INTO `complain_table` (`complain_id`, `ticket_id`, `complain_text`, `complain_image`, `complain_audio`) VALUES(?,?,?,?,?)';
$query=$db->prepare($sql);
$values=array($complain_id, $ticket_id, $complain, $imageData, NULL);;
$query -> execute($values);
$fetch_sql=$sql="SELECT Name, Email FROM `person_table` WHERE ticket_id ='".$ticket_id."'";
$fetch_query=$db->prepare($fetch_sql);
$fetch_query->execute();
$fetch_obj=$fetch_query->fetch(PDO::FETCH_OBJ);
$admin_email = "Abhijog@feedbackdesignlab.com";
$email =$fetch_obj->Email;
$user_name=$fetch_obj->Name;
$subject = 'Complain Registration';
$comment = 'Dear '.$user_name.', your Complain ID is '.$complain_id.'. Use the Complain ID to track your complain.';
mail($email, "$subject", $comment, "From:" . $admin_email);
echo "The complain has been lodged.Please check your e-mail for the complain ID for tracking";
Everthing正在插入除数据库之外的数据库中。我无法在我的代码中找到任何错误。请帮助