因此,在这里试图学习更多的实验室,并......试图增加一个用户通过移动向服务器上载(an)的形象,即:上载——file...oh和现在装在WAMP上。
the book im reading ...long story short, the example shown doesnt work. Ive Googled around and literally copy pasted a few relavant examples ive found and still....well to be clear, be it that i wrote it or from the net, i can upload the image name (along with other values) to tables on the db i have set up but the image itself doesn t move to the directory I ve set up for it.
我把我的所有手法都删除到简单的桌子上,而简单地把他放在别处,以确保任何东西都不相冲突,而且仍然 n。
我是:
<form method="post" action="testUpload.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="32768" >
<table summary="guitarwars lesson" width="500">
<tr>
<td>load picture:</td>
<td><input type="file" name="screenshot" id="screenshot" ></td>
</tr>
<tr>
<td><input type="submit" name="submit" action="submit"></td>
</tr>
</table>
</form>
这里是我的营地:
<?php
$screenshot = $_FILES[ screenshot ][ name ];
//$destination = "images/user_avatars/$screenshot";
$insertValues = "INSERT INTO testdb(screenshot) VALUES ( $screenshot )";
//---declare connection.
$connect2db = mysqli_connect( 127.0.0.1 , root , pass , dbname );
if(!$connect2db){
die("Sorry but theres a connection to database error" . mysqli_error);
} else {
//pg intro mssg
echo <span style="font-size:25px; color:green;"> --- Link Established with Database ---.<span/><br/><br/> ;
}
// put into db.
if(!empty($screenshot)) {
$insertData = mysqli_query($connect2db, $insertValues);
echo data submitted. thank you ;
move_uploaded_file ($_FILES[ screenshot ][ tmp_name ],"images/user_avatars/{$screenshot}");
echo IMAGE UPLOAD COMPLETE ;
}
mysqli_close($connect2db);
?>
now i dont get an error...i actually get the echo "image upload complete" part... and like i said, with the app code, i get multiple values AND the image name going through and being saved onto the db, but the image itself being moved from temp to my location is a no go.
any tips links, etc i gladly appreciate. Thank you in advance.