[nycphp-talk] need help with input type="file"
Nasir Zubair
lists at ny-tech.net
Wed Dec 10 18:35:55 EST 2003
Try this:
$name = $_FILES['name']['name'];
The first "['name']" is the name of your file field. The second 'name' is
for accessing the name of uploaded file.
http://www.php.net/manual/en/features.file-upload.php
- Nasir
> -----Original Message-----
> From: Michael Southwell [mailto:southwell at dneba.com]
> Sent: Wednesday, December 10, 2003 6:18 PM
> To: talk at lists.nyphp.org
> Subject: [nycphp-talk] need help with input type="file"
>
>
> 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
> ======================================================
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
>
>
More information about the talk
mailing list