This is CorpseEater's reply on your message send to him on 8/15/2002 :

Bo> basically this a code for uploading images and text info into a mysql
Bo> database, however, when I execute this code, an error occured as:
Bo> Undefined variable: action in \phpmySQL\add.php on line 2
Bo> what will be the problem?

Bo> <?php


Bo> if ((isset($action)||($action == "upload")) {


Bo>   // ok, let's get the uploaded data and insert it into the db now
Bo>   include "";

Bo>   if (isset($binFile) && $binFile != "none") {
Bo>     $data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
Bo>     $strDescription = addslashes(nl2br($txtDescription));
Bo>     $sql = "INSERT INTO tbl_Files ";
Bo>     $sql .= "(description, bin_data, filename, filesize, filetype) ";
Bo>     $sql .= "VALUES ('$strDescription', '$data', ";
Bo>     $sql .= "'$binFile_name', '$binFile_size', '$binFile_type')";
Bo>     $result = mysql_query($sql, $db);
Bo>     mysql_free_result($result); // it's always nice to clean up!
Bo>     echo "Thank you. The new file was successfully added to our
Bo> database.<br><br>";
Bo>     echo "<a href='main.php'>Continue</a>";
Bo>   }
Bo>   mysql_close();

Bo> } else {
Bo> <HTML>
Bo> <BODY>
Bo> <FORM METHOD="post" ACTION="add.php" ENCTYPE="multipart/form-data">
Bo>  <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
Bo>  <INPUT TYPE="hidden" NAME="action" VALUE="upload">
Bo>   <TR>
Bo>    <TD>Description: </TD>
Bo>    <TD><TEXTAREA NAME="txtDescription" ROWS="10" COLS="50"></TEXTAREA></TD>
Bo>   </TR>
Bo>   <TR>
Bo>    <TD>File: </TD>
Bo>    <TD><INPUT TYPE="file" NAME="binFile"></TD>
Bo>   </TR>
Bo>   <TR>
Bo>    <TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
Bo>   </TR>
Bo>  </TABLE>
Bo> </FORM>
Bo> </BODY>
Bo> </HTML>
Bo> <?php
Bo> }


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to