Jump to content

Getting value from <INPUT TYPE="file"


RogerInHawaii

Recommended Posts

I have a simple form on my page as follows:

 

<form METHOD=post ENCTYPE="multipart/form-data">
   <input TYPE="file" NAME="filename">
   .. other input fields...
</form>

 

which produces a text control plus a Browse button which allows the user to either directly enter a file name or select a file by bringing up a browse dialog.

 

After the user subsequently hits the Submit button for the form, in the processing of the form data I attempt to retrieve the file name that he has entered, with the following:

 

<?php
$TheFileName = $_POST['filename'];
?>

 

but no matter what the user enters the retrieved file name is always empty. I can always get the value in other form fields, but never the one in the File field.

 

What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/57647-getting-value-from/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.