hailam Posted April 23, 2009 Share Posted April 23, 2009 I am running file hosting script, but the problem is that the script is not allowing me to upload .rar files. Can anyone tell me how to add .rar extention to the lines below: $valid_file_types = array( array('avi', 'video/avi', 'Video Clip'), array('avi', 'video/msvideo', 'Video Clip'), array('avi', 'video/x-msvideo', 'Video Clip'), array('jpg', 'image/jpeg', 'JPG Image'), array('jpeg', 'image/jpeg', 'JPEG Image'), array('jpg', 'image/pjpeg', 'JPG Image'), array('jpeg', 'image/pjpeg', 'JPEG Image'), array('zip', 'application/x-zip-compressed', 'Compressed Zip File'), array('zip', 'application/zip', 'Compressed Zip File'), array('zip', 'multipart/x-zip', 'Compressed Zip File') ); Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/ Share on other sites More sharing options...
sdi126 Posted April 23, 2009 Share Posted April 23, 2009 I would echo out the file type: $_FILES["file"]["type"]; Once you know the type you can add it to your list Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-817925 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 array('rar', 'not sure what goes here', 'not sure what goes here'); shouldnt that work? you just have to figure out what goes in the 2nd and 3rd values... which shouldnt be too hard Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-817927 Share on other sites More sharing options...
hailam Posted April 23, 2009 Author Share Posted April 23, 2009 I am very new to scripts, I didn't get what you mean. I was thinking a line like this array('rar', 'multipart/x-rar', 'Compressed Rar File') may help, but it didn't work Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-817928 Share on other sites More sharing options...
sdi126 Posted April 23, 2009 Share Posted April 23, 2009 It doesn't work because multipart/x-rar is not a valid "MIME" type. I think it should be "application/x-rar-compressed" I was just saying on the upload code to print out what it is so you know for sure Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-817931 Share on other sites More sharing options...
hailam Posted April 24, 2009 Author Share Posted April 24, 2009 array('zip', 'application/zip', 'Compressed Zip File') is also not working. File does not appear to be a supported type (application/octet-stream). Please try another format. Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-818001 Share on other sites More sharing options...
hailam Posted April 24, 2009 Author Share Posted April 24, 2009 I mean array('rar', 'application/x-rar-compressed', 'Compressed Rar File'), it's also not working. Can anyone tell me how to .rar files. PLEASE Quote Link to comment https://forums.phpfreaks.com/topic/155435-how-to-add-rar-extention-to-this-script/#findComment-818221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.