note 24642 deleted from features.file-upload by victor
| From: | victor@php.net | Date: | Sat, 24 Aug 2002 15:44:38 +0000 |
| Subject: | note 24642 deleted from features.file-upload by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35516@lists.php.net to get a copy of this message | ||
I'm running PHP 4.0.6, and I tried to get Example 20-2 working with $HTTP_POST_FILES for the
uploading of PDF articles for a website. I was unsuccessful, but I was able to come up with a work
around. Here are some code snippets that I used in my working version:
in the html form:
<input type='hidden' name='MAX_FILE_SIZE' value='8000000'>
<input name='article' type='file'>
in the processing php file:
if (is_uploaded_file($article))
{
// $file is composed of variables to ensure that different article types are put in their
corresponding directories
$file = "../articles/" . $section . "/" . $id . ".pdf";
move_uploaded_file($article, $file) or die("Error! File not moved!");
print "File uploaded to: " . $file;
}
else
{
echo "Possible file upload attack. Filename: " . $article_name;
}