You probably need to specify the path in the filesize call also.  It
looks like you are just pushing the filename.

Like 

$filepath = "/home/www/nortonway/photos/$filename";
$fd = fopen($filepath, "rb"); 
$filedata = fread ($fd, filesize($filepath)); 
$zipfile -> add_file($filedata, "$filename"); 
fclose ($fd);

HTH

- Paul

-----Original Message-----
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 12:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Can anyone see what's wrong with this code?


HI there Everyone,

Finally found the list address again, my computer crashed and I lost
everything, sigh.  Anyway, i'm zipping a file and it's zipping the
filename ok but not the file and I have a feeling it's something wrong
with the below, as I get an error on the filesize parameter saying no
such file, even though I know it is there.

For this example, think of $filename as having mypic.jpg stored in it
(Which it does, checked and it echoed the name), so I specified the
server path and that got rid of that error, but the filesize one is just
frustrating me, is it something simple i'm missing?  I've looked into
the PHP manual and seems it should be working.

$fd = fopen("/home/www/nortonway/photos/$filename", "rb"); $filedata =
fread ($fd, filesize($filename)); $zipfile -> add_file($filedata,
"$filename"); 
fclose ($fd);

Any help would be extremely appreciated.

Regards

Chris

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to