tmpfile() errors?
| From: | Jas | Date: | Wed, 22 May 2002 20:17:33 +0000 |
| Subject: | tmpfile() errors? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-98818@lists.php.net to get a copy of this message | ||
Here are the errors I am recieving:
Warning: fopen("Resource id #4","wb") - Permission denied in
/path/to/asciiartist.php on line 295
Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 296
Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 297
Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
/path/to/asciiartist.php on line 303
ASCIIArtist(): Cannot determine image type of shared/image02.jpg.
I have checked the file permissions for the files and directory in question
and they are all set to read & write, so I know this is not the problem.
Here is the function that I am trying to get to work.
function ASCIIArtist($image)
{
if ($input = @fopen($image, "rb")) {
$image_data = fread ($input, 2048576);
fclose($input);
$tmp_image = tmpfile();
$output = fopen($tmp_image, "wb");
fwrite($output, $image_data);
fclose($output);
} else {
exit("Cannot access ".$image." for reading. (Does not exist or
has wrong permissions)");
}
This code is from http://www.sebastian-r.de/. And
everything works fine
until it hits this function. Could I get some enlightenment on why it cannot
create a temp file named $tmp_image? (ecspecially when the permissions for
the file are correct?) Thanks in advance,
Jas