Re: Hi
| From: | Richard Quadling | Date: | Mon, 06 Sep 2010 14:01:40 +0000 |
| Subject: | Re: Hi | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307868@lists.php.net to get a copy of this message | ||
On 6 September 2010 14:46, Jordan Jovanov <jovanovjoce@gmail.com> wrote:
> Hi All
>
> I need me a little help.
> I create scripte for upload file is work very good but the problem is next:
> I neet to upload only .zip file i need to disable some user to shoise to
> upload another file Extensions.
>
> Can somebody help me.
>
> Thanks a lot.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Using standard HTML ... no. There is nothing in the <input type="file>
element to instantly limit the file type. You can use JavaScript to
some degree (http://www.codestore.net/store.nsf/unid/DOMM-4Q8H9E for
example).
As far as PHP goes, one of the values returned to you is the
$_FILES['userfile']['type'] property.
If this matches the zip file mime type (application/x-zip but also
application/x-gzip and maybe multipart/x-gzip, multipart/x-zip), then
you have a better chance of knowing it is a zip file.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY