<?php
include '../database/db.php';
if(isset($_POST['email1'])){
$email=$_POST['email1'];
$caption= $_POST['caption'];
//upload image
$file=$_FILES['image']['tmp_name'];
if (!isset($file)) {
}else{
$image= addslashes(file_get_contents($file));
$image_name= addslashes($file);
$image_size= getimagesize($file);}
if ($image_size=="") {
die(mysql_error());}
else{
move_uploaded_file($_FILES["image"]["tmp_name"],"../pics/" . $_FILES["image"]["name"]);
$images="../pics/" . $_FILES["image"]["name"];
//Create query
$sql="INSERT INTO pic (filename,email,caption) VALUES '`$images`'``,'$email',``'`$caption`')`"`;
if (!mysql_query($sql))
{
echo '<script>alert("Please rename your picture only letters or numbers are valid");</script>';
}
echo '<iis_get_script_map(server_instance, virtual_path, script_extension)>alert("Successfully Uploaded!"); window.location="home.php";</script>';
}
}
else{
die(mysql_error());
}
?>
警告:file_get_contents():第15行的文件名不能为空
警告:getimagesize():第17行的文件名不能为空