YourNameHere Posted August 25, 2009 Share Posted August 25, 2009 I am trying to put the name of a file into a database. the simplest method would be to grab the name from the post data from the form. This isnt working. the column remains empty. I tryied $_FILES[$fieldname]['tmp_name'] to no avail. I am lost. Quote Link to comment https://forums.phpfreaks.com/topic/171819-getting-the-value-of-file-input-php/ Share on other sites More sharing options...
ignace Posted August 25, 2009 Share Posted August 25, 2009 post your code Quote Link to comment https://forums.phpfreaks.com/topic/171819-getting-the-value-of-file-input-php/#findComment-906102 Share on other sites More sharing options...
Alex Posted August 25, 2009 Share Posted August 25, 2009 $_FILES[$fieldname]['name'] Quote Link to comment https://forums.phpfreaks.com/topic/171819-getting-the-value-of-file-input-php/#findComment-906103 Share on other sites More sharing options...
Mark Baker Posted August 25, 2009 Share Posted August 25, 2009 $_FILES is a simple non-associative array Use $_FILES[0] rather than $_FILES[$fieldname] Quote Link to comment https://forums.phpfreaks.com/topic/171819-getting-the-value-of-file-input-php/#findComment-906133 Share on other sites More sharing options...
ignace Posted August 25, 2009 Share Posted August 25, 2009 $_FILES is a simple non-associative array Use $_FILES[0] rather than $_FILES[$fieldname] Euhm.. $_FILES['userfile']['name'] The original name of the file on the client machine. $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted. $_FILES['userfile']['size'] The size, in bytes, of the uploaded file. $_FILES['userfile']['tmp_name'] The temporary filename of the file in which the uploaded file was stored on the server. $_FILES['userfile']['error'] The error code associated with this file upload. This element was added in PHP 4.2.0 Multiple files are accessed as: $_FILES['userfile']['name'][0] Quote Link to comment https://forums.phpfreaks.com/topic/171819-getting-the-value-of-file-input-php/#findComment-906187 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.