Samantha S. Ollinger on Fri, 21 Mar 2003 11:34:20 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] php prob: downloads empty file


Hi all,

I have fiddled with this problem for a while, and I still cannot figure it
out. There is a file in a directory that is not accessible just by typing
in the url (protected dir). In this directory I have the files that I want
to be downloaded.

Problem is the file I download is empty:
-rw-------    1 sam music           0 Mar 21 11:20 so.zip

I read on of the lists that the "maximum execution time" determines the
size I can allow to be downloaded. According to phpinfo I have 30 as the
local and master value. I don't think I have understood what  "maximum
execution time" really means

Here is two samples that I have tried with the same result:

$filename='so.zip';
$fullfilepath='/protectedfiles/SS/';
$contentType='application/octet-stream';
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: $contentType");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-length:".(string)(filesize($fullfilepath)));
$fd=fopen($fullfilepath,'r');
fpassthru($fd);
------------------------------------------
$file="/protectedfiles/SS/so.zip";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=so.zip");
readfile("/protectedfiles/SS/so.zip");
-----------------------------------------------

Does anyone have any ideas? I have tried every single example listed at
php.net under the readfile and fpassthru

Thanks.
-Samantha


_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug