Warning: fread(): supplied argument is not a valid stream
Posted: Sat May 19, 2007 10:39 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
am trying to upload images in MySql using php. whenever I run the following code I get this message:
Warning: fread(): supplied argument is not a valid stream resource in C:\webs\test\CNST Projects\Genaral Upload Form\figUpload.php on line 6
config.php is where I assign the database, the user, and the password.
openDB.php is where the database is opened
closeDB.php is where the database is closedCode: Select all
<?php
include'phpFigures/config.php';
include'phpFigures/openDB.php';
include'phpFigures/assignValues.php';
if (isset($figpath)){
$figImage=addslashes(fread(fopen($figpath,"r"),filesize($figpath)));
$query = "INSERT INTO images(description, image) VALUES ('$figdescription', '$figImage')";
mysql_query($query) or die("Query failed: " . mysql_error());
echo "The figure is successfully Uploaded!";
}
else{
echo "You did not Upload any figure!";
}
include'phpFigures/closeDB.php';
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]