$picfilename = $_FILES['pic_map']['tmp_name'];
echo '<b>Name: '.$picfilename;
$picsize = getimagesize($picfilename);
echo $picsize;
<form name="addmapform" method="post" action="objectadd.php"> Account name: <input type="text" name="name" id="name"><br> Account password: <input type="password" name="pass" id="pass"><p></p> <label for="ref"> <big>Map Name:</big></label><br> <input name="ref" type="text" id="ref" value="" size="50"><p></p> Type<br> <select name="objecttype" id="objecttype"> <option value="PAWN_Code">PAWN code</option> <option value=".map">.map file</option> </select><p></p> <label for="pawn_objects"><b><big> Map data:</b></big></label> <p> <i>Objects</i><br> <textarea name="pawn_objects" id="pawn_objects" cols="50" rows="10">Here CreateObject();</textarea><br> <i>Cars</i><br> <textarea name="car_spawns" id="car_spawns" cols="50" rows="30">Here CreateVehicle();</textarea> <!--<label for="datafile">or upload .map file:<br></label> <input type="file" id="datafile" name="datafile" size="40">--> </p> <label for="pic_map"><b><big> Map screenshot (size must be 125x125)</big></b><br> <input type="file" id="pic_map" name="pic_map" size="40"><p></p> <input type="submit" name="submit" id="submit" value="Submit my map !"> </form>
list($width, $height, $type, $attr) = getimagesize($_FILES['pic_name']['tmp_name']);
if ($width > 125 || $height > 125)
{
echo "Maximum width and height exceeded. Please upload images below 125 x 125 px size";
exit();
}
// Check file extension then save the file.
Add enctype="multipart/form-data" to your <form>.
I want to check the image size, then it should be save. PHP код:
Are you blind :P ? He is clearly using POST method. |
<form name="addmapform" method="post" action="objectadd.php" enctype="multipart/form-data">
echo $width . " - " . $height . " - " . $type . " - " . $attr;
exit(); and die(); do the same work they'll kill the process.
|
$upload_dir = '/MapImages';
$tmp_name = $_FILES['pic_map']['tmp_name'];
$name = $_FILES['pic_map']['name'];
move_uploaded_file($tmp_name,"$upload_dir/$name");
echo "Image ". $_FILES['pic_map']['name'] ." uploaded successfully.<br>";
move_uploaded_file($_FILES['pic_map']['tmp_name'],"/httpdocs/MapImages/".$_FILES['pic_map']['name']);
$filename = $_FILES["pic_map"]["name"];
$filetmplocation = $_FILES["pic_map"]["tmp_name"];
$path = "MapImages/".$filename;
$result = move_uploaded_file($filetmllocation, $path);
if ($result == true) {
echo "File has been moved from " . $filetmplocation . " to" . $path;
} else {
echo "ERROR: File not moved correctly";
}