The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: swat | January 11, 2009 @ 3:38am
PHP Code
[
Download
]
<?php if ($action == "upload") { // ok, let's get the uploaded data and insert it into the db now include "opendb.php"; if (isset($binFile) && $binFile != "none") { $data = addslashes(fread(fopen($binFile, "r"), filesize($binFile))); $strDescription = addslashes(nl2br($txtDescription)); $sql = "INSERT INTO tbl_Files "; $sql .= "(description, bin_data, filename, filesize, filetype) "; $sql .= "VALUES ('$strDescription', '$data', "; $sql .= "'$binFile_name', '$binFile_size', '$binFile_type')"; $result = mysql_query($sql, $db); // mysql_free_result($result); // it's always nice to clean up! echo "Thank you. The new file was successfully added to our database.<br><br>"; echo "<a href='main.php'>Continue</a>"; } mysql_close(); } else { ?> <HTML> <BODY> <FORM METHOD="post" ACTION="add.php" ENCTYPE="multipart/form-data"> <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000"> <INPUT TYPE="hidden" NAME="action" VALUE="upload"> <TABLE BORDER="1"> <TR> <TD>Description: </TD> <TD><TEXTAREA NAME="txtDescription" ROWS="10" COLS="50"></TEXTAREA></TD> </TR> <TR> <TD>File: </TD> <TD><INPUT TYPE="file" NAME="binFile"></TD> </TR> <TR> <TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD> </TR> </TABLE> </FORM> </BODY> </HTML> <?php } ?>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.35 / 8
173 Votes
http://codebin.yi.org/211
page generated in 0.00 seconds