whisperstream Posted July 9, 2006 Share Posted July 9, 2006 So I have a strange problem and I'm not quite sure where to look.When I upload a file, the $_FILES array is filled up correctly except for the 'name' element which is always set to a blank array. Everything else is set correctly and I have no problems reading the uploaded file using the tmp_name file name. The problem is that I need to determine the file type and so need the original file extension. using print_r this is what I get:Array( [fileData] => Array ( [name] => Array ( ) [type] => text/xml [tmp_name] => C:\PROGRA~1\EASYPH~1\\tmp\php29F.tmp [error] => 0 [size] => 1222 ))Ok so I get the type in the php array, but research tells me that you can't always rely on that.I should also say that I'm using EASYPHP windows with PHP version 4.3.10. Do I need to set a flag to get this info, or is a windows implementation bug or something else?Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/ Share on other sites More sharing options...
kenrbnsn Posted July 9, 2006 Share Posted July 9, 2006 What does your form look like?Ken Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55211 Share on other sites More sharing options...
whisperstream Posted July 9, 2006 Author Share Posted July 9, 2006 I think my form is ok, it's not the ubiquitous enctype problem (I hope!)<form name="galleryForm" method="post" action="uploadPage.php" enctype="multipart/form-data"><table> <tr> <td>Upload File :</td> <td> <input type="file" name="fileData"> </td> </tr></table></form> Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55229 Share on other sites More sharing options...
kenrbnsn Posted July 9, 2006 Share Posted July 9, 2006 I don't see a submit button in your form. How is it being submitted?Ken Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55231 Share on other sites More sharing options...
whisperstream Posted July 9, 2006 Author Share Posted July 9, 2006 sorry chopped that part off, here's the submit button<form name="galleryForm" method="post" action="uploadPage.php" enctype="multipart/form-data"><table> <tr> <td>Upload File :</td> <td> <input type="file" name="fileData"> </td> </tr> <tr><td><input type="image" src="images/icons/save.gif" width="19" height="19" border="0" name="image"></td></tr></table></form> Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55243 Share on other sites More sharing options...
Daniel0 Posted July 9, 2006 Share Posted July 9, 2006 Try adding a submit button instead. If you need it to be that picture, use this code instead: [code]<button type='submit' style='border: 0px; padding; 0px;'><img src='images/icons/save.gif' width='19' height='19' border='0'></button>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55248 Share on other sites More sharing options...
whisperstream Posted July 9, 2006 Author Share Posted July 9, 2006 just tried that now, makes no difference, file will upload fine, just name part is blanked, I'll try with a different web host and see if I get a different result to the one i'm getting on my local machine Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55254 Share on other sites More sharing options...
whisperstream Posted July 9, 2006 Author Share Posted July 9, 2006 Found it, bad coding......I thought the globals were read only, but earlier in the code due to misuse of preg_match was setting $_FILEs['fileData']['name'] to it result matches.Thanks for all the suggestion, the button syntax was useful too, will now adopt :) Quote Link to comment https://forums.phpfreaks.com/topic/14104-filesfvname-is-empty-but-not-filesfvtmp_name/#findComment-55256 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.