Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/04/2014, 12:15
Avatar de AngelMarine
AngelMarine
 
Fecha de Ingreso: enero-2014
Ubicación: Madrid
Mensajes: 79
Antigüedad: 11 años, 2 meses
Puntos: 0
Pregunta ¿Dónde puede estar el error en este código?

Me da este error:

Parse error: syntax error, unexpected 'location' (T_STRING) in C:\wamp\www\upload_crop_v1.2.php on line 211


Abajo esta resaltada en negrita la línea (211) que supuestamente esta mal



if (file_exists($large_image_location)){
if(file_exists($thumb_image_location)){
$thumb_photo_exists = "<img style=\"vertical-align: middle;\" src=\"".$upload_path.$thumb_image_name.$_SESSION['user_file_ext']."\" alt=\"Thumbnail Image\"/>";
}else{
$thumb_photo_exists = "";
}
$large_photo_exists = "<img src=\"".$upload_path.$large_image_name.$_SESSION['user_file_ext']."\" alt=\"Large Image\"/>";
} else {
$large_photo_exists = "";
$thumb_photo_exists = "";
}

if (isset($_POST["upload"])) {

$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
$filename = basename($_FILES['image']['name']);
$file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));


if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) {

foreach ($allowed_image_types as $mime_type => $ext) {

if($file_ext==$ext && $userfile_type==$mime_type){
$error = "";
break;
}else{
$error = "Only <strong>".$image_ext."</strong> images accepted for upload<br />";
}
}

if ($userfile_size > ($max_file*1048576)) {
$error.= "Images must be under ".$max_file."MB in size";
}

}else{
$error= "Select an image for upload";
}

if (strlen($error)==0){

if (isset($_FILES['image']['name'])){

$large_image_location = $large_image_location.".".$file_ext;
$thumb_image_location = $thumb_image_location.".".$file_ext;

$_SESSION['user_file_ext']=".".$file_ext;

move_uploaded_file($userfile_tmp, $large_image_location);
chmod($large_image_location, 0777);


$reqlen = strlen ($large_image_name);
if ($reqlen > 0) {
require("connect_db.php");
$meter = @mysql_query('INSERT INTO images (img_name) values ("'.mysql_real_escape_string($large_image_name."." .$file_ext)."')');
}


$width = getWidth($large_image_location);
$height = getHeight($large_image_location);

if ($height > $max_height){
$scale = $max_height/$height;
$uploaded = resizeImage($large_image_location,$width,$height,$ scale);
}else{
$scale = 1;
$uploaded = resizeImage($large_image_location,$width,$height,$ scale);
}

if (file_exists($thumb_image_location)) {
unlink($thumb_image_location);
}

}

header("location:".$_SERVER["PHP_SELF"]);
exit();
}
}