|
|
|
จะทำอัพโหลด รูปภาพ สำเนาประชาชนพนักงานทำไงครับ/การทำ form แบ่งหน้าทำไงครับ |
|
|
|
|
|
|
|
Code (PageUploadToMySQL1.html)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<form name="form1" method="post" action="PageUploadToMySQL2.php" enctype="multipart/form-data">
<input type="file" name="filUpload"><br>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>
Code (PageUploadToMySQL2.php)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
if(copy($_FILES["filUpload"]["tmp_name"],"myfile/".$_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("mydatabase");
$strSQL = "INSERT INTO files ";
$strSQL .="(FilesName) VALUES ('".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
?>
<a href="PageUploadToMySQL3.php">View files</a>
</body>
</html>
Code (PageUploadToMySQL3.php)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM files";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="200" border="1">
<tr>
<th width="50"> <div align="center">Files ID </div></th>
<th width="150"> <div align="center">Files Name </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["FilesID"];?></div></td>
<td><center><a href="myfile/<?=$objResult["FilesName"];?>"><?=$objResult["FilesName"];?></a></center></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>
|
|
|
|
|
Date :
2009-10-07 18:15:33 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ
|
|
|
|
|
Date :
2009-10-08 17:38:09 |
By :
helmet |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
https://www.thaicreate.com/php/forum/032736.html
ดูเลยคับเค้าเคยโพสกันบางแล้ว
|
|
|
|
|
Date :
2009-10-08 22:17:37 |
By :
apicha31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|