JustinK101 Posted February 3, 2009 Share Posted February 3, 2009 I have a file upload field: <form name="uploadForm" enctype="multipart/form-data" action="" method="post"> <strong>Upload Image:</strong> <input name="fileField" id="fileField" type="file" size="45" /> <input type="button" value="Upload Image" id="upload_image" onclick="submit(this.form);" /> </form> Then at the top of the php page I am trying to get the filename from the field by: echo "file = " . $_POST['fileField']; But its empty. Does a `file` field not pass its value along to post? Thanks. Link to comment https://forums.phpfreaks.com/topic/143569-input-type-file-not-passing-file/ Share on other sites More sharing options...
Philip Posted February 3, 2009 Share Posted February 3, 2009 You might want to read into a tutorial on how to upload files in PHP: http://www.tizag.com/phpT/fileupload.php Link to comment https://forums.phpfreaks.com/topic/143569-input-type-file-not-passing-file/#findComment-753309 Share on other sites More sharing options...
JustinK101 Posted February 3, 2009 Author Share Posted February 3, 2009 I have got a custom upload script, I just need to know if indeed the value of $_POST['fileFIeld'] is not passed. I know there is a global $_FILES where the actual file exists. It is just weird that $_POST['fileField'] doesn't have the filename. Link to comment https://forums.phpfreaks.com/topic/143569-input-type-file-not-passing-file/#findComment-753311 Share on other sites More sharing options...
Philip Posted February 3, 2009 Share Posted February 3, 2009 It will not, you'd have to use $_FILES['fileField']['name'] Link to comment https://forums.phpfreaks.com/topic/143569-input-type-file-not-passing-file/#findComment-753313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.