I want to create a "browse" button that will upload the NAME of a file (just the name, NOT the file) and pass that name onto another page. I have written the following:

echo '<FORM ENCTYPE="multipart/form-data" ACTION="InsertImageFile.php" METHOD=POST>';

 echo '<table cellpadding = 5 border = 1> <tr><td>';
 echo 'File Name </td><td>';
 echo '<INPUT NAME="FileName" size ="45" TYPE="file">';
 echo '</td></tr> <tr><td>';

 echo 'Description </td><td> <input type = "text" name = "PicDescrip" size ="45" value = "">';
  echo '</td></tr> <tr><td>';

 echo '<input type = "submit" value = "Add Image"> </td></tr></table></center></form>';

When this code executes nothing is sent to the receiving page. Am I right is guessing that the system is trying to send the file instead of the text of the file name?

How do I fix this?

9 Years
Discussion Span
Last Post by scru

I havent tested this, but you can create a hidden form field, and set its value to the filename upon selecting with javascript. When the form submits, try deleting the file input beforehand from the DOM.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.