note 19212 deleted from features.file-upload.multiple by aidan
| From: | aidan@php.net | Date: | Sun, 19 Sep 2004 03:28:54 +0000 |
| Subject: | note 19212 deleted from features.file-upload.multiple by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76967@lists.php.net to get a copy of this message | ||
Note Submitter: fjeanson at yahoo dot com
----
by the way to grab the pointer to which name="userfile[]" points at in the html
<form>, all you need is
$userfile[0] or $userfile[$i] at index $i.
ex to upload a file:
<?
$userf = $userfile[0];
$fname = $HTTP_POST_FILES['userfile']['name'][0];
if($fname!=""){
$dat = date("d,m,y");
$fp = fopen ($userf, "rb");
$fileSize = filesize($userf);
$contents = fread($fp,$fileSize);
fclose($fp);
if ($fileSize<2000000){
$fp = fopen("$directory/$fname","wb");
fwrite($fp, $contents);
} else {
echo "<hr> Your file is way to big!!!<hr>";
}
fclose($fp);
}
?>
there u go ;)