note 109222 deleted from language.types.string by danbrown
| From: | danbrown@php.net | Date: | Wed, 27 Jun 2012 16:34:58 +0000 |
| Subject: | note 109222 deleted from language.types.string by danbrown | ||
| References: | 1 | Groups: | php.notes php.notes |
| Request: | Send a blank email to php-notes+get-188923@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
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";
}
?>