hay estan los dos files!! el folder en el servidor es foto!
html
nombre buscar.html
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" enctype="multipart/form-data" action="up.php">
<span class="text_button">
<input name="image" type="file" id="image"/>
</span>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</form>
</body>
</html>
nombre: up.php
Código PHP:
<?
$uploaddir = "foto/";
$uploadfile = $uploaddir . basename($_FILES['image']['name']);
move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile) ;
$file="$uploadfile";
chmod($file,0644);
$max_upload_width = 1000;
$max_upload_height = 674;
list($image_width, $image_height) = getimagesize($file);
if($image_width>$max_upload_width || $image_height >$max_upload_height){
$proportions = $image_width/$image_height;
if($image_width>$image_height){
$new_width = $max_upload_width;
$new_height = round($max_upload_width/$proportions);
}
else{
$new_height = $max_upload_height;
$new_width = round($max_upload_height*$proportions);
}
$new_image = imagecreatetruecolor($new_width , $new_height);
if($exts2 == "gif"){$image_source = imagecreatefromgif($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagegif($new_image,$file,90);}
if($exts2 == "GIF"){$image_source = imagecreatefromgif($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagegif($new_image,$file,90);}
if($exts2 == "jpg"){$image_source = imagecreatefromjpeg($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$file,90);}
if($exts2 == "JPG"){$image_source = imagecreatefromjpeg($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$file,90);}
if($exts2 == "jpeg"){$image_source = imagecreatefromjpeg($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$file,90);}
if($exts2 == "JPEG"){$image_source = imagecreatefromjpeg($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$file,90);}
if($exts2 == "png"){$image_source = imagecreatefrompng($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagepng($new_image,$file,90);}
if($exts2 == "PNG"){$image_source = imagecreatefrompng($file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagepng($new_image,$file,90);}
imagedestroy($new_image);
}
echo "<meta http-equiv=\"refresh\" content=\"0; URL=buscar.html\">";
?>