|
|
|
รบกวนช่วยดูให้หน่อยนะค่ะ คือสร้างแบบฟอร์มไว้ให้ อัพไฟล์กับรูป งงว่าทำไมไม่เลือกรูปเอาลงมันก็ยังบอกว่าเราเลือกไฟล์มาด้วย |
|
|
|
|
|
|
|
มันบอกว่าเราอัพไป 96 ไบท์ค่ะ ขอบคุณมากค่า
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script href="bootstrap1/js/bootstrap.min.js" rel="stylesheet"></script>
<link href="bootstrap1/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap1/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<!--<script>
$(document).ready(function() {
$("form").validate({
rules: {test: {minlength: 3,email: true}},
showErrors: function(errorMap, errorList) {
$.each(this.successList, function(index, value) {return $(value).popover("hide");});
return $.each(errorList, function(index, value) {
var _popover;
console.log(value.message);//message from popover
_popover = $(value.element).popover({
trigger: "manual",
placement: "top",
content: value.message,
template: "<div class=\"popover\"><div class=\"arrow\"></div><div class=\"popover-inner\"><div class=\"popover-content\"><p></p></div></div></div>"
});
_popover.data("popover").options.content = value.message;
return $(value.element).popover("show");
});
}
});
});
</script>-->
<body>
<form method="post" action="saveUpload.php" enctype="multipart/form-data">
<fieldset>
<legend>Upload Project</legend>
Project Name : <input name="Name" id="Name" type="text" placeholder="Type something"/>
Advisor : <input name="Email" id="Email" type="text" placeholder="Type something"/>
</fieldset>
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input span3"><i class="icon-file fileupload-exists"></i><span class="fileupload-preview"></span></div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="File"></span><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
<input type="submit" name="Submit" value="Save" class="btn">
</form>
<script src="http://code.jquery.com/jquery-1.7.min.js" ></script>
<script src="bootstrap/FileUpload/bootstrap-fileupload.js" type="text/javascript"></script>
</body>
</html>
Code (PHP)
<?
mysql_connect("localhost","root","123");
mysql_select_db("test");
if($_FILES["File"]["name"] != "")
{
//*** Read file BINARY ***'
$fp = fopen($_FILES["File"]["tmp_name"],"r");
$ReadBinary = fread($fp,filesize($_FILES["File"]["tmp_name"]));
fclose($fp);
$FileData = addslashes($ReadBinary);
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","123") or die("Error Connect to Database");
$objDB = mysql_select_db("test");
$strSQL = "INSERT INTO test ";
$strSQL .="(Name,Proj) VALUES ('".$_POST["Name"]."','".$FileData."')";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
mysql_close($objConnect);
}
?>
Tag : PHP
|
|
|
|
|
|
Date :
2013-06-17 15:42:26 |
By :
mrronalz |
View :
746 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เมื่อสักครู่ลองเอา #
Code (PHP)
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
ออกค่ะ แล้วมันก็ทำได้แล้ว แต่อยากทราบว่าทำไมถึงเกิดจากตัวนี้หรอคะ
|
|
|
|
|
Date :
2013-06-17 15:51:35 |
By :
mrronalz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|