Hey, mates,
I want to make a file upload form and found the cookbook tip for this, however, I need to go further, please, consider the follow situation:
1 - the user performs the upload
2 - the system checks for the file's mimetype and validate it
3 - if it's a zip/compressed file, the system must extract it to a folder
4 - so, the system will loop thru the folder and check each file's mimetype
now, my questions for each item given above:
1 - alright, Yii provides this feature - OK
2 - here I'm facing a problem. If I use CFileHelper::getMimeType() function, I always get a null value, but if I use CFileHelper::getMimeTypeByExtension() instead, it works fine and gives me the string containing the file's type
3 - does Yii provide such funcionality? extract a compressed file, compress files?
4 - great, Yii provides this feature with CFileHelper - OK, but again I need to perform a validation by mimetypes
the reason I want to perform a mimetype check is that the files will be uploaded in order to be published and somebody could upload an exe, bat, or anything instead of allowed files, just changing the extension…I mean, if I rename file.bat to file.zip, the system must reject the file and drop the action
any suggestions will be very appreciated
thanks