millercj Posted April 21, 2008 Share Posted April 21, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.