Menu

martes, 9 de junio de 2009

PHP Tips & Tricks - A Picture Upload, Part 1

PHP Tips & Tricks - A Picture Upload, Part 1: "if(!isset($_FILES) && isset($HTTP_POST_FILES))
$_FILES = $HTTP_POST_FILES;

if(!isset($_FILES['image_file']))
$error['image_file'] = 'An image was not found.';


$imagename = basename($_FILES['image_file']['name']);
//echo $imagename;

if(empty($imagename))
$error['imagename'] = 'The name of the image was not found.';

if(empty($error))
{
$newimage = 'images/' . $imagename;
//echo $newimage;
$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
if(empty($result))
$error['result'] = 'There was an error moving the uploaded file.';
}"
Publicar un comentario