|
|
|
อับโหลดรูปไม่ได้ ทำไงดีครับใครรู้บ้างผมเขียน php upload อยากอัพรูปเกบไว้ถานข้อมูน |
|
|
|
|
|
|
|
Code (PHP)
<?php
/*ini_set('display_errors', 1);
error_reporting(~0);
$hostzz = "localhost";
$userzz = "root";
$passzz = "root";
$dbname = "book";*/
$userz=$_POST["usernamez"];
$psz=$_POST["passwordz"];
$nz=$_POST["namez"];
$gz=$_POST["genderz"];
$pz=$_POST["phonez"];
$ez=$_POST["emailz"];
$dayzz=$_POST["dayz"];
$monthzz=$_POST["monthz"];
$yearzz=$_POST["yearz"];
$date=$yearzz."-".$monthzz."-".$dayzz;
/*$conn = mysqli_connect($hostzz,$userzz,$passzz,$dbname);
$sql = "INSERT INTO user (id, username, password, name, phone, email, gender, date_of_birth, date_register, status, iamge) VALUES ('', '$userz', '$psz', '$nz', '$pz', '$ez', '$gz', '".$date."', NOW(), 'teacher', '".$_FILES["filUpload"]["name"]."')";
$query = mysqli_query($conn,$sql);
if($query) {
echo "Record add successfully";
}
mysqli_close($conn);*/
?>
<?php
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"image/".$_FILES["filUpload"]["name"]))
{
echo "Copy/Upload Complete<br>";
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("book");
$strSQL = "INSERT INTO user ";
$strSQL .="(id, username, password, name, phone, email, gender, date_of_birth, date_register, status, iamge) VALUES ('', '$userz', '$psz', '$nz', '$pz', '$ez', '$gz', '".$date."', NOW(), 'teacher', '".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2017-10-28 14:11:13 |
By :
keekkeek |
View :
681 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$hexa_content=bin2hex(file_get_contents($_FILES["filUpload"]["tmp_name"]));
$sql="update picture set image = 0x$hexa_content where id=$id";
|
|
|
|
|
Date :
2017-10-28 20:08:34 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|