Re: Uploading Files

From: Date: Mon, 22 May 2006 20:24:22 +0000
Subject: Re: Uploading Files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236669@lists.php.net to get a copy of this message
On Sun, May 21, 2006 3:52 am, P. Guethlein wrote: > I'm at one of those frustration levels.... can't seem to get a > script working that will post and upload a file to the server. I"m > working with the below. Can you help? > > <?php var_dump($_FILES); > $numoffile = 1; > > $file_dir = "d:/upload/"; > if ($_FILES['myfiles']) { > print_r ($_FILES); > for ($i=0;$i<$numoffile;$i++) { > if (trim($_FILES['myfiles']['name'][$i])!="") { > $newfile = $file_dir.$_FILES['myfiles']['name'][$i]; > move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], > $newfile); > $j++; > } > } > } > if (isset($j)&&$j>0) print "Your file(s) has been uploaded.<br>"; > > echo ' > <form enctype="multipart/form-data" action="__URL__" > method="POST"> > <!-- MAX_FILE_SIZE must precede the file input field --> > <input type="hidden" name="MAX_FILE_SIZE" value="30000" > /> > <!-- Name of input element determines name in $_FILES array --> > Send this file: <input name="myfiles" type="file" /> > <input type="submit" value="Send File" /> > </form>'; > > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#236669) next »