Prev: PHP Modular application
Next: workflow system design
From: Jordan Jovanov on 6 Sep 2010 09:46 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.
From: kranthi on 6 Sep 2010 09:57 use some thing like http://uploadify.com u can always check for the uploaded file extension/mime-type on the server side
From: chris h on 6 Sep 2010 10:00 You can check the extension of the uploaded file http://www.php.net/manual/en/features.file-upload.post-method.php But to be sure that it's truly a zip file you could actually open the file with php's zip function. http://php.net/manual/en/ref.zip.php Chris. On Mon, Sep 6, 2010 at 9:46 AM, Jordan Jovanov <jovanovjoce(a)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 > >
From: Richard Quadling on 6 Sep 2010 10:01 On 6 September 2010 14:46, Jordan Jovanov <jovanovjoce(a)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
From: "=?utf-8?B?YXNoQGFzaGxleXNoZXJpZGFuLmNvLnVr?=" on 6 Sep 2010 10:04
I think you should not focus so much on the file extension, as that is mostly meaningless if someone wanted to attack your system. Instead, you could wrap a call to the command line 'file' command, which gives mostly accurate information about a file. Basically it reads the first few bytes to see it is what it expected. There is a php wrapper for this, but I forget what its called just now. If you do need to just grab a file extension though, you can do it with a call to pathinfo() with the 2nd argument of PATHINFO_EXTENSION. Thanks, Ash http://www.ashleysheridan.co.uk ----- Reply message ----- From: "Jordan Jovanov" <jovanovjoce(a)gmail.com> Date: Mon, Sep 6, 2010 14:46 Subject: [PHP] Hi To: <php-general(a)lists.php.net> Cc: <jovanovjoce(a)gmail.com> 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 |