파일 및 데이터를 캡처하고 PHP 파일에 업로드하는 데 문제가 있습니다. 나는 누군가가 어쩌면 내가 뭘 잘못하고 있는지 볼 수 있다면 내가 뭘 잘못하고 있는지 모르겠다. 그것은 문제 파일/이미지를 업로드하지 않습니다하지만 난 텍스트 입력을 추가 할 때 내가html 파일 및 텍스트 데이터를 PHP에 제출
<iframe name="my_iframe" src="" id="my_iframe"></iframe>
<form action="http://www.********/upload11.php" method="post" enctype="multipart/form-data" target="my_iframe">
<input type="file" input id="input" name="image" />
<input type="text" name="Description" value="Image of Time"/>
<div>
<input type="submit" value="Send">
</div>
</form>
upload11.php 재판을 템플릿으로 사용하고 무엇을 여기에 작동하지 않습니다되어 게시
<?php
$upload_image = $_FILES["image"][ "name" ];
$folder = "images/";
move_uploaded_file($_FILES["image"]["tmp_name"], "$folder".$_FILES["image"]["name"]);;
$file = 'images/'.$_FILES["image"]["name"];
$uploadimage = $folder.$_FILES["image"]["name"];
$newname = $_FILES["image"]["name"];
$resize_image = $folder.$newname;
list($width,$height) = getimagesize($uploadimage);
$newwidth = 550;
$newheight = 350;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($resize_image);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, $resize_image, 100);
$out_image=addslashes(file_get_contents($resize_image));
$msg = '';
if($_SERVER['REQUEST_METHOD']=='POST'){
$a = ('" alt="" />');
$b = ("'<img src=\"\https://www.******/images/".$_FILES['image']['name']."$a'");
$Description = $_POST['Description'];
$image = $_FILES['image']['tmp_name'];
$img = file_get_contents($image);
$con = mysqli_connect('***','******','******','********');
$sql = "INSERT INTO links (hyper_links, link) VALUES ($b, $Description)";
$stmt = mysqli_prepare($con,$sql);
mysqli_stmt_bind_param($stmt, "s",$img);
mysqli_stmt_execute($stmt);
$check = mysqli_stmt_affected_rows($stmt);
if($check==1){
$msg = 'Successfullly UPloaded';
}else{
$msg = 'Could not upload';
}
mysqli_close($con);
}
?>
<?php
echo $msg;
?>
** error_reporting (E_ALL); **을 추가하여 이미지를 업로드하는 동안 오류를 확인하십시오. – Sunny
내가 내 PHP 파일에 추가했지만, 내가 제출하면 그냥 업로드 할 수 없습니다. – INOH
나는이 질문에 대한 내 대답을 살펴 보시기 바랍니다 : [전체 보안 이미지 업로드 스크립트] (http://stackoverflow.com/questions/38509334/full-secure-image-upload-script/38712921 # 38712921)이 스크립트는 업로드 스크립트와 보안에 대해 많은 것을 가르쳐 줄 것입니다. 텍스트 필드를 폼에 쉽게 추가하고 PHP로 처리 할 수 있습니다. 이것은 전혀 문제가되지 않습니다. – icecub