Dejo el código para ver si me pueden ayudar.
Código PHP:
Ver original
<?php include ("connect.php"); include ("function.php"); $id = $_SESSION["id"]; $id = $getname["id"]; $firstname = $getname["firstname"]; $image1 = $getname["image1"]; $image2 = $getname["image2"]; $image3 = $getname["image3"]; if ($image1 != "") { if ($image2 != "") { if ($image3 != "") { $curr_image = $id . "_3"; } else $curr_image = $id . "_3"; } else $curr_image = $id . "_2"; } else $curr_image = $id . "_1"; if ($_REQUEST[callid] == 2) { $ph1 = $HTTP_POST_FILES['userfile']['name']; $userfile = $_FILES['userfile']['tmp_name']; if ($ph1 != "") { $path1 = "photo/"; $imagefile = "$curr_image" . "$extension1"; $dest1 = $path1 . $imagefile; } //if } //if //$imagefile = image_upload($userfile, $image, "photo/", 90, 90, 100, 0) or die("error"); if ($curr_image == $id . "_1") { @mysql_query("update prueba set image1= '$imagefile',curr_image='$imagefile',cap1='$Caption' where id='$_SESSION[id]'"); } if ($curr_image == $id . "_2") { $query = "update prueba set image2= '$imagefile',curr_image='$imagefile',cap2='$Caption' where id='$_SESSION[id]'"; } if ($curr_image == $id . "_3") { @mysql_query("update prueba set image3= '$imagefile',curr_image='$imagefile',cap3='$Caption' where id='$_SESSION[id]'"); } } function image_upload($userfile, $newfile, $directory, $width, $height, $quality = '100', $smooth = '10', $extention = 'AUTO') { if (($imgsize[0] > $width) || ($imgsize[1] > $height)) { // unlink($tmpimg); } $mimetype = $_FILES['userfile']['type']; if ($extention == "AUTO") { if (($mimetype == "image/x-png") || ($mimetype == "image/png")) { $extention = "png"; } elseif ($mimetype == "image/pjpeg") { $extention = "jpg"; } elseif ($mimetype == "image/gif") { $extention = "gif"; } else { $extention = ""; $error_message = "Please upload images with the extension .jpg or .jpeg or .gif or .png only"; } } $newfile_name = $newfile . "." . $extention; $newfile = $directory . $newfile_name; $error_message = "Error Uploading File."; } } return $newfile_name; } else { $error_message = "Not An Image"; } } if ($error_message == "") { } else { echo $error_message; } ?>
Gracias de antemano, den_22