Warning: fread(): supplied argument is not a valid stream

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
phpDVWeaver
Forum Commoner
Posts: 28
Joined: Sun Apr 29, 2007 11:00 pm

Warning: fread(): supplied argument is not a valid stream

Post by phpDVWeaver »

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 closed
$figpath is the php variable that holds the path of the figure to upload (it's an input wher the type is file and the name is figurepath )
php:

Code: 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';
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

We have a very special forum for php related issues and this ain't it.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Moved :arrow: PHP -Code.
Locked