drumhrd Posted October 11, 2009 Share Posted October 11, 2009 hello all you wonderful php freaks. I am trying to setup an uploader. Content will be mp3. I am trying to get the mime type of the uploaded files in the form but I cannot seem to get it to work. $mime_type = mime_content_type($_FILES['userfile1']['tmp_name']); this results in an empty variable. I know php has that wonderful little function called getimagesize $imageinfo = getimagesize($_FILES['userfile1']['tmp_name']); which results in a $imageinfo['mime']. But of course I cannot use it on mp3 files. just trying to get some simular functionality. Thanks Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/ Share on other sites More sharing options...
jon23d Posted October 11, 2009 Share Posted October 11, 2009 I use apache_lookup_uri(), though for some reason it only seems to work on some servers, I haven't yet figured out why! Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934790 Share on other sites More sharing options...
drumhrd Posted October 11, 2009 Author Share Posted October 11, 2009 I checked the php site for apache_lookup_uri() and don't see mime type listed as an object returned by this function. When user uploads a file..I need to check the mime type for audio/mpeg3 || audio/x-mpeg-3 I cannot figure out how to go about getting the mime type from the user uploaded file so I can check it before it is processed by move_uploaded_file Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934795 Share on other sites More sharing options...
jon23d Posted October 11, 2009 Share Posted October 11, 2009 It is in the property content_type, but is the same as mime type. Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934797 Share on other sites More sharing options...
drumhrd Posted October 11, 2009 Author Share Posted October 11, 2009 this is getting just what's passed in the http headers right...I want what's actually in the file header. I can manipulate the http headers with what ever mime type I want..this is not secure. Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934799 Share on other sites More sharing options...
jon23d Posted October 11, 2009 Share Posted October 11, 2009 No, that is not the case. Did you read the manual? This has absolutely nothing to do with http headers... Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934801 Share on other sites More sharing options...
drumhrd Posted October 11, 2009 Author Share Posted October 11, 2009 ok this seems to work..thanks for the help. Link to comment https://forums.phpfreaks.com/topic/177293-upload-mime-type-non-image-checker/#findComment-934804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.