note 109223 deleted from features.file-upload by aharvey
| From: | aharvey@php.net | Date: | Mon, 23 Jul 2012 07:03:13 +0000 |
| Subject: | note 109223 deleted from features.file-upload by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189367@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Restrictions on Upload
In this script we add some restrictions to the file upload. The user may only upload .gif or .jpeg
files
First Program:
<body>
<form name="file" action="uploadimag.php" method="post"
enctype="multipart/form-data">
<input type="file" name="file" value="" />
<input type="submit" value="upload" name="upload" />
</form>
</body>
</html>
Second Program:
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg"))
{
echo "Image Upload";
}
else
{
echo "please only Image Upload";
}
?>