Re: upload picture

From: Date: Wed, 07 Jan 2004 19:30:34 +0000
Subject: Re: upload picture
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174002@lists.php.net to get a copy of this message
This works for me My Form <?php ?> <form enctype="multipart/form-data" action="savefile.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="filename" type="file"> <input type="submit" value="Send File"> </form> savefile.php <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of // $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file() // instead of move_uploaded_file $uploaddir = '/fullDirectoryPath'; $uploadfile = $uploaddir. $_FILES['filename']['name']; print "<pre>"; if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } print "</pre>"; ?> Matt Hedges wrote:
Hello... could anyone please tell me how to upload a picture using php? I have this <input type="file" name="picture1" size="20"> but don't know how to specify how to store the pictures on the server... thanks! thanks Matt
-- +-----------------+-----------------+----------------+ | Blake Schroeder | Owner/Developer | lhwd.net | +--(http://www.lhwd.net)------------+--/3174026352\--+

« previous php.general (#174002) next »