NYCPHP Meetup

NYPHP.org

[nycphp-talk] need help with input type="file"

Michael Southwell southwell at dneba.com
Wed Dec 10 18:18:19 EST 2003


The following works perfectly if name is input type="text" but doesn't 
return anything if type="file," although the browse box is created and 
works.  What (no doubt something simple) am I missing?
------------------------
<?php
$execute=$_POST[execute];

if (!isset($execute)){ //first time through
   WriteForm();
   }
else {  //here from post
   $name=$_POST[name];
   echo "The submitted filename is ".$name;
   }

function WriteForm(){
   global $name;
?>
   <form method="post" enctype="multipart/form-data" action="browsebox.php">
     <input type="hidden" name="execute" value="true" />
     Filename:<br />
     <input type="file" name="name" value="<?=$name; ?>" size="75" /><br />
     <br />
     <input type="submit" value="Submit filename" />
   </form>
<?php
}
?>


Michael G. Southwell =================================
DNEBA Enterprises
81 South Road
Bloomingdale, NJ 07403-1419
973/492-7873 (voice and fax)
southwell at dneba.com
http://www.dneba.com
======================================================




More information about the talk mailing list