Can anyone see what's wrong with this code?
| From: | Chris Payne | Date: | Tue, 27 Jan 2004 18:51:30 +0000 |
| Subject: | Can anyone see what's wrong with this code? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-32645@lists.php.net to get a copy of this message | ||
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