Jump to content

Help on Zip MIME


millercj

Recommended Posts

I'm trying to add file type restrictions to my upload script. I want to allow .zip files I've included all of these (application/zip, application/x-compressed, application/x-zip-compressed, Mime: multipart/x-zip) but my script below keeps returning "Sorry, your file is the wrong type". Any ideas?

 

<?php
if($_FILES['Filedata']['type']=="application/x-compressed" || $_FILES['Filedata']['type']=="application/x-zip-compressed" || $_FILES['Filedata']['type']=="application/zip" || $_FILES['Filedata']['type']=="multipart/x-zip")
{
//proper file format 
$target = "complete/";
$target = $target . basename( $_FILES['Filedata']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $target))
{
echo "The file has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file";
}
}
else
{
//illegal file format
echo "Sorry, your file is the wrong type";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/102128-help-on-zip-mime/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.