LooieENG Posted July 21, 2008 Share Posted July 21, 2008 How do I get the info $_FILES['file']['type'] contains? :/ I tried print_r($_FILES) and it just said Array() Edit: html <p><form action="upload.php" method="post" name="uploader"> <input name="file" type="file" size="50" /><input type="submit" name="upload" value="Upload" /> </form></p> Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/ Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 print_r($_FILES['file']['type']); I think (I think it's in array form) Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595126 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Thanks for the reply. I tried that, and also print_r($_FILES['file']) and both showed a blank screen Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595129 Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 try a simple print_r($_FILES); Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595133 Share on other sites More sharing options...
Lodius2000 Posted July 21, 2008 Share Posted July 21, 2008 oddly enough i am doing this right now print $_FILES['file']['type']; will do it Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595134 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Gave me a blank screen :| Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595137 Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 ok, time for error checking: if (isset($_FILES)){ print_r($_FILES); } else{ print "FILES is empty!"; } Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595140 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Returned Array ( ) Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595141 Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 then $_FILE is empty Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595142 Share on other sites More sharing options...
Lodius2000 Posted July 21, 2008 Share Posted July 21, 2008 from above print $_FILES['file']['type']; make sure that 'file' corresponds to the name given to your input not the type, i made the name uploadfile so your form should say <input type="file" name="uploadfile"> hen my files array code looks like $_FILES['uploadfile']['type'] so print that and you are golden, if you still get a blank screen then something is wrong with php Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595143 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Blank screen... Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595148 Share on other sites More sharing options...
Lodius2000 Posted July 21, 2008 Share Posted July 21, 2008 bull, j/k dunno whats wrong man sorry i cant help Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595151 Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 when I had him print $_FILES, and he got Array( ), which means it's not broke, it's just getting nothing. Data isn't showing up. Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595152 Share on other sites More sharing options...
Lodius2000 Posted July 21, 2008 Share Posted July 21, 2008 wonder what setup hes using (if php is installed correctly) not that i would know how to fix it Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595164 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 http://ehwtf.com/phpinfo.php Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595168 Share on other sites More sharing options...
kenrbnsn Posted July 21, 2008 Share Posted July 21, 2008 Please show us the form you are using. It's most likely that there is a problem with the form. Ken Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595169 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Please show us the form you are using. It's most likely that there is a problem with the form. Ken <p><form action="upload.php" method="post" name="uploader"> <input name="file" type="file" size="50" /><input type="submit" name="upload" value="Upload" /> </form></p> Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595170 Share on other sites More sharing options...
kenrbnsn Posted July 21, 2008 Share Posted July 21, 2008 If you look in the fine manual you will notice that the form tag must include the attribute enctype="multipart/form-data". Without that the $_FILES array does not get filled in. Ken Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595171 Share on other sites More sharing options...
LooieENG Posted July 21, 2008 Author Share Posted July 21, 2008 Hmm, didn't see that. Thanks, Ken and everyone else who posted. Link to comment https://forums.phpfreaks.com/topic/115762-solved-how-do-i-get-this/#findComment-595179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.