Re: File Upload Headaches

From: Date: Thu, 19 Jul 2001 06:41:12 +0000
Subject: Re: File Upload Headaches
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58617@lists.php.net to get a copy of this message
On Thu, 19 Jul 2001 16:06, Jason Rennie wrote: > Hi all, > > Can anybody see what is wrong with this code ?? > > > echo "\$userfile = $userfile"; > echo $HTTP_POST_FILES['userfile']['tmp_name']; > > > // now to provide an assignment submission box > print "<P>"; > print "<FORM ENC_TYPE=\"multipart/form-data\" > ACTION=\"$param&upload=true\" METHOD=\"post\" >\n"; print > "<INPUT > TYPE=\"hidden\" NAME=\"MAX_FILE_SIZE\" > VALUE=\"1048576\">\n"; print > "<H4>Submit A File</H4><P> "; > print "<INPUT TYPE=\"file\" NAME=\"userfile\" > >\n<P>"; > print "<INPUT TYPE=\"submit\" VALUE=\"Upload\">\n"; > print "</FORM>"; > > > this is just a code fragment but, essentially the form submits back to > itself. > > When i try to output the $HTTP_POST_FILE['userfile']['any thing'] > variables they are not set, and $userfile is simply set to the filename > on the other computer. > > Any ideas about what an earth i'm doing wrong ???? > > Jason It's been a while since I needed to do this, but here's what I wrote and as far as I know it still works :-0 <FORM ENCTYPE="multipart/form-data" ACTION="<?php echo basename($PHP_SELF)?>" NAME="files" METHOD=POST> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000"> <INPUT NAME="userfile" TYPE="FILE" SIZE="40"> <INPUT TYPE=submit VALUE="Submit File"> [Lots left out for simplicity] I notice you have ENC_TYPE ?? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Heads I win, tails you lose.

« previous php.general (#58617) next »