Page 1 of 1
errno=2
Posted: Wed Jan 14, 2004 10:02 pm
by bogdani
Hello everybody,
Can you help me with this? From where is generated this error (having in mind that the code is okay and it worked nicely on my localhost server and on another remote server).
Warning: filesize() [function.filesize]: Stat failed for (errno=2 - No such file or directory) in /usr/home/admin/sites/my/_admin/do_upload.php on line 4
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/admin/sites/my/_admin/do_upload.php on line 4
Thanks!
Posted: Wed Jan 14, 2004 10:34 pm
by AVATAr
show us line 4.
the first warning message is very obvious.. the file or directory does not exists...
that error generate the second warning because the script didnt generate de right resource.
Posted: Wed Jan 14, 2004 10:38 pm
by bogdani
Line 4: $data2 = addslashes(fread(fopen($form_data2, "r"), filesize($form_data2)));
It is a form that uploads an image into database...
Posted: Wed Jan 14, 2004 10:42 pm
by bogdani
I'ts very weird. It seems to have something to do with that hosting provider ? Some settings to database / server ?
Posted: Thu Jan 15, 2004 4:55 am
by AVATAr
how do you fetch #form_data2, using $_POST or $_GET?
Posted: Thu Jan 15, 2004 5:07 am
by twigletmac
When you echo $form_data2 what to you get?
Mac
Posted: Thu Jan 15, 2004 9:12 am
by bogdani
I am using POST to submit data,..
twigletmac -> I remind you that the script is 100% okay on other 2 servers, but on this FreeBSD hosted server it gives me this error,..
Thanks
Posted: Thu Jan 15, 2004 9:19 am
by twigletmac
bogdani wrote:Twigletmac -> I remind you that the script is 100% okay on other 2 servers, but on this FreeBSD hosted server it gives me this error,..
Doesn't make a difference, what if there are different configurations and/or versions of PHP on each server? You really should check what is in $form_data2 - the error message doesn't seem to give a file name. Unless you purposefully removed that then it's kinda suspicious.
Mac
Posted: Thu Jan 15, 2004 12:12 pm
by bogdani
the problem was from register globals which was off,... now I upload the image using $_FILES and it's okay.
but when I'm trying to display it, it just give me "Array" instead of content of the image,.. do you know what code should I use ?
I use:
Code: Select all
<?php
if($id) {
mysql_select_db($database_ft, $ft);
$query = "select id,photo_small1 from products where id=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"photo_small1");
Header( "Content-type: image/JPEG");
echo $data;
};
?>
Posted: Thu Jan 15, 2004 1:08 pm
by DuFF
The MySQL result is returning an array.
Instead of echo $data, do something like:
Code: Select all
<?php
foreach ($data as $key => $value) {
echo "Key: $key; Value: $value<br>\n";
}
?>
Obviously this will need reformatting to fit the way you would like it, but its a start. If you don't know what arrays are I suggest you do some reading.
http://www.php.net/manual/en/language.types.array.php
http://lineman.net/article98.html
http://www.devshed.com/c/a/PHP/Array-Ma ... With-PHP4/