supir
12-23-2005, 02:24 AM
hi guys...this the code i copy from ttp://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/2/..exactly..copy the code and paste it on dreamweaver..
its run smoothly BUT.............everytime i clicked "upload", it show "You must enter both a description and file"....can u help me..here..i posted a code :
grabfile.php ::
<?php
// GrabFile.php: Takes the details
// of the new file posted as part
// of the form and adds it to the
// myBlobs table of our myFiles DB.
global $strDesc;
global $fileUpload;
global $fileUpload_name;
global $fileUpload_size;
global $fileUpload_type;
// Make sure both a description and
// file have been entered
if(empty($strDesc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "mobster";
$dbUser = "ajad";
$dbPass = "ajad2";
$fileHandle = fopen($fileUpload, "r");
$fileContent = fread($fileHandle, $fileUpload_size);
$fileContent = addslashes($fileContent);
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>";
echo "<b>File name:</b> $fileUpload_name <br>";
echo "<b>File type:</b> $fileUpload_type <br>";
echo "<b>File size:</b> $fileUpload_size <br>";
echo "<b>Uploaded to:</b> $fileUpload <br><br>";
echo "<a href='uploadfile.php'>Add Another File</a>";
?>
thanks...
its run smoothly BUT.............everytime i clicked "upload", it show "You must enter both a description and file"....can u help me..here..i posted a code :
grabfile.php ::
<?php
// GrabFile.php: Takes the details
// of the new file posted as part
// of the form and adds it to the
// myBlobs table of our myFiles DB.
global $strDesc;
global $fileUpload;
global $fileUpload_name;
global $fileUpload_size;
global $fileUpload_type;
// Make sure both a description and
// file have been entered
if(empty($strDesc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "mobster";
$dbUser = "ajad";
$dbPass = "ajad2";
$fileHandle = fopen($fileUpload, "r");
$fileContent = fread($fileHandle, $fileUpload_size);
$fileContent = addslashes($fileContent);
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>";
echo "<b>File name:</b> $fileUpload_name <br>";
echo "<b>File type:</b> $fileUpload_type <br>";
echo "<b>File size:</b> $fileUpload_size <br>";
echo "<b>Uploaded to:</b> $fileUpload <br><br>";
echo "<a href='uploadfile.php'>Add Another File</a>";
?>
thanks...