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
[syntax="php"]
<?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';