Paul on Wed, 26 Mar 2003 11:45:28 -0500


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

Re: [PLUG] php prob: downloads empty file


Have you solved this problem?

The "maximum execution time" determines how long a script is allowed to run. Most scripts execute quickly. The 30 second limit prevents things like endless loops from continuing forever. And who wants to wait even 30 seconds for a script on a Web site to run?!

Are you trying to send a file /to/ the server, or retrieve a file /from/ the server?

Have you tried basic methods of sending and receiving files? In the simplest cases, PHP is required to send a file, but a simple link can be used to retrieve a file. I'm suggesting testing methods of increasing in complexity. Start with the basics with files that are know to sucessfully transfer.

I'm not exactly sure about what you're trying to accomplish, but it seems like an .htaccess file could do the job of limiting access to a collection of files.


Samantha S. Ollinger wrote:

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



_________________________________________________________________________ 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