You are here: Re: upload big file « PHP Programming Language « IT news, forums, messages
Re: upload big file

Posted by ZeldorBlat on 10/09/98 11:36

wakun@wakun.com wrote:
> wakun@wakun.com wrote:
> > Hi there,
> > I am using a POST method to upload a big file (20M), I have already
> > set the max-upload-file = 30M in php.ini and have the hidden
> > MAX_FILE_SIZE=30M in multipart form. However, it still refuse to upload
> > such file. For some reason, I am not going to use ftp instead. Any
> > idea?
> >
> > Thanks in advance.
>
> Now, I figure out the problem by setting the post_max_size=40M in
> php.ini but I get another problem about offering a big file to
> download. I have the download script as follow
>
> $len = filesize($absfile);
> $fd = fopen($absfile, "rb");
> $contents = fread($fd, $len);
> fclose($fd);
>
> $t = "application/pdf";
>
>
> header("Content-Type: $t");
> header("Content-Length: $len");
> header("Content-Disposition: inline; filename=$filename");
> header("Pragma: private"); // fix for IE
>
> echo $contents;
>
> I found it takes almost one minute to download the file bigger than
> 20M?

You might want to try sending the file in "chunks". Remember that
$contents now contains at least 20MB of data in memory (and perhaps
elsewhere). See if something like this works better:

$fd = fopen($absfile, "rb");
while (!feof($fd))
echo fread($fd, 8192);

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация