 |
|
ทราบมาว่า longblob อัพได้เต็ม 4GBนิครับ เเล้วทำยังไงถึงจะอัพได้มากๆๆ ได้10MBก้อพอละเเต่นี้ 1M ยังไม่ได้เลยย
พออัพโหลด1MBมันก้อerrorอย่างนี้ครับ
Warning: fread(): supplied argument is not a valid stream resource in C:\Apache2.2\htdocs\testupload.php on line 24
CREATE TABLE binary_data (
id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
description CHAR(50),
bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50)
);
////////////////////////////page upload ครับ/////////////////////////////////////////
Code (PHP)
<?php
// store.php3 - by Florian Dittmer <[email protected]>
// Example php script to demonstrate the storing of binary files into
// an sql database. More information can be found at http://www.phpbuilder.com/
?>
<html>
<head><title>Store binary data into SQL Database</title></head>
<body>
<?php
// code that will be executed if the form has been submitted:
if ($submit) {
// connect to the database
// (you may have to adjust the hostname,username or password)
MYSQL_CONNECT("localhost","root","710389@it");
mysql_query("SET NAMES TIS620"); //**************
mysql_select_db("binary_data");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); //line 24 จุดที่มันErrorเเก้ตรงไหนครับ
$result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ".
"VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
// else show the form to submit new data:
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?php
}
?>
</body>
</html>
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2010-11-12 20:34:25
|
 |
 |
 |
 |
Date :
2010-11-12 20:17:05 |
By :
51035354 |
View :
3281 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |