note 14376 added to function.fopen.php
| From: | corne at dejongmkb dot nl | Date: | Sat, 28 Jul 2001 09:20:40 +0000 |
| Subject: | note 14376 added to function.fopen.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15980@lists.php.net to get a copy of this message | ||
As a newbe on php I seem to have a lot of problems with uploading large files.
When I transfer text files everything works smothley. But when I start to upload music it stops
after a while.
This is the code i'm using on my site:
<?
print "<html><body bgcolor=black><font color=yellow
size=4><center>";
for($i=0;$i<sizeof($userfile);$i++)
{
$FileName ="upload/".$userfile_name[$i];
$fp = @fopen($FileName,"r");
if ($fp)
{
print"<font color=yellow>The file $userfile_name[$i] exists!";
print"<br>";
}
else
{
if(!$userfile_size[$i])
continue;
$UPLOAD = fopen( $userfile[$i], "r" );
$contents = fread( $UPLOAD,$userfile_size[$i]);
fclose( $UPLOAD );
$SAVEFILE = fopen("upload//".$userfile_name[$i], "wb" );
fwrite( $SAVEFILE, $contents,$userfile_size[$i] );
fclose( $SAVEFILE );
$fp = @fopen($FileName,"r");
if ($fp)
{
print"<font color=yellow>The file $userfile_name[$i] has arrived!";
print"<br>";
}
else
{
print"<font color=yellow>The file $userfile_name[$i] has failed!";
print"<br>";
}
}
}
echo "<body></html>";
?>
http://www.php.net/manual/nl/function.fopen.php