|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
greetings.
i am following the Blobbing Data With PHP and mySQL article. i am getting an error which states: " You must enter both a description and file " in grabfile.php after i have entered the description and chosen the file to upload. is something missing from the tutorial? |
|
#2
|
|||
|
|||
|
did you copy/paste the code??? could you please post it hear so we can take a look
|
|
#3
|
|||
|
|||
|
Blobbing
greetings.
thanks for responding. i found the error. the tutorial is great but there are missing elements if you are just starting out with php. everything works except when i try to download an image that is stored in the database. the page is returned but with a broken link. |
|
#4
|
|||
|
|||
|
if you could post the code that actually prints the data? i think i know what is wrong, but i just need to check the code to be sure
|
|
#5
|
|||
|
|||
|
Blobbing Phase 3
here is the code that returns the stored images:
<?php global $blobId; if(!is_numeric($blobId)) die("Invalid blobId specified"); // Database connection variables $dbServer = "192.168.254.73"; $dbDatabase = "myFiles"; $dbUser = "root"; $dbPass = ""; $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"); $dbQuery = "SELECT blobType, blobData "; $dbQuery .= "FROM myBlobs "; $dbQuery .= "WHERE blobId = $blobId"; $result = mysql_query($dbQuery) or die("Couldn't get file list"); if(mysql_num_rows($result) == 1) { $fileType = @mysql_result($result, 0, "blobType"); $fileContent = @mysql_result($result, 0, "blobData"); header("Content-type: $fileType"); echo $fileContent; } else { echo "Record doesn't exist."; } ?> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Blobbing Data With PHP and mySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|