�����������֡��
A little text to describe your forum 
¤ÍÁ¾ÔÇàµÍÃìÈÖ¡ÉÒ  
 ÊÁѤÃÊÁÒªÔ¡(Register)��Ѥ���Ҫԡ(Register) 
 ªèÇÂàËÅ×Í���������   ¤é¹ËÒ����   ÃÒª×èÍÊÁҪԡ��ª�����Ҫԡ   ¡ÅØèÁ¼Ùéãªé���������� 
 ¢éÍÁÙÅÊèǹµÑÇ(Profile)��������ǹ���(Profile)   à¢éÒÊÙèÃкºà¾×èÍàªç¤¢éͤÇÒÁÊèǹµÑÇ�������к������礢�ͤ�����ǹ���   à¢éÒÊÙèÃкº(Log in)�������к�(Log in) 
Important Notice: We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024. If you wish to migrate to our paid hosting service, please contact [email protected].
�ѻ��Ŵ�ٻ���������� folder ����红����� mysql

 
Forum ¹Õé¶Ù¡ÅçÍ¡ ¤Ø³äÁèÊÒÁÒöµÍº ËÃ×Íá¡éä¢ä´é   ËÑÇ¢é͹Õé¶Ù¡ÅçÍ¡ ¤Ø³äÁèÊÒÁÒöá¡éä¢ ËÃ×͵ͺä´é    ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Ö¡ï¿½ï¿½ -> +�+WEB+�+
��ҹ��Ǣ�͡�͹˹�� :: ��ҹ��Ǣ�ͶѴ�  
����� ��ͤ���
ryuozero
Site Admin


�������: 13 Jul 2005
�ͺ: 1145

µÍºï¿½Íºï¿½ï¿½ï¿½ï¿½ï¿½: Sat Oct 20, 2007 5:08 pm    ï¿½ï¿½ï¿½ï¿½Í§: �ѻ��Ŵ�ٻ���������� folder ����红����� mysql µÍºâ´ÂÍéÒ§¢éͤÇÒÁ

��ҧ�ԧ�ҡ:
http://www.thaicreate.com/description_tutor.php?frame=DisplayTrue&id=69
�͡Ẻ�ҹ�����Ŵѧ���

Create Database picture;

CREATE TABLE picture (
id int(3) NOT NULL auto_increment,
images longblob NOT NULL,
PRIMARY KEY (id)
);


��鹷�� 1 �� From ���� ���͡������ uploads

Sample1.php

<html>
<head>
<title>Un title page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
body { margin: 0px 0px; padding: 0px 0px}
a:link { color: #005CA2; text-decoration: none}
a:visited { color: #005CA2; text-decoration: none}
a:active { color: #0099FF; text-decoration: underline}
a:hover { color: #0099FF; text-decoration: underline}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<br>
<form method="POST" action="sample2.php" enctype ="multipart/form-data">
<font face="MS Sans Serif" size="2"> ��� Logo</font>
<input type="file" name="files">
<input type="submit" name="Submit" value="uploads">
</form>
</body>
</html>




Out Put




��鹷�� 2 �͡Ẻ From ���� uploads ���

Sample2.php

<?
$host="localhost";
$username="";
$pass_word="";
$db="picture";
mysql_connect( $host,$username,$pass_word) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������");


$filename =$HTTP_POST_FILES['files']['name'];
$filetempname =$HTTP_POST_FILES['files']['tmp_name'];
$filesize =$HTTP_POST_FILES['files']['size'];

$fp = fopen($filetempname,"r");
$data = fread($fp,filesize($filetempname));
fclose($fp);
$data = addslashes($data);


$sql="insert into picture(images) values ('$data')";
$db_query=mysql_db_query($db,$sql);
echo"Uploads �ٻ�Ҿ���º��������";

?>


Out Put





��鹷�� 3 �͡Ẻ From ���� �֧�ٻ�Ҿ���ʴ�

<?
$host="localhost";
$username="";
$pass_word="";
$db="picture";
mysql_connect( $host,$username,$pass_word) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������");

$sql = "select * from picture where id=1"; // �ҡ��ͧ��ô֧੾�� Reccord � Record ˹�� ��������� where id='$�����'
$result = mysql_query($sql) or die("�������ö query ��������");

$images = mysql_fetch_array($result);
echo $images['images']

?>

Sample3.php





�����ҧ�ҹ�����šѹ���

CREATE TABLE `picture` (
`id` int(11) NOT NULL auto_increment,
`picture` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;

��С��� �Ӥ������㨡��ѹ˹��¹Ф�Ѻ

<?php
$host="localhost";
$username="root";
$pass_word="";
$db="uploadtest";
$tb="picture";

echo "<table width='98%' border='0' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<td><div align='center'> <font color='#FF0000'><strong>�к� test upload </strong></font></div>";
echo "<table width='50%' border='0' align='center' cellpadding='1' cellspacing='5'>";
echo "<tr>";
echo "<td>";
echo "<form name='form1' enctype='multipart/form-data' method='post' action='$PHP_SELF?t=send'>";
echo "���͡������ Uploads ";
echo "<input type='file' name='file' class='txt'>";
echo "<input type='submit' name='send' value='�ѻ��Ŵ���' class='bot'>";
echo "</form></td>";
echo "</tr>";
echo "</table></td>";
echo "</tr>";
echo "</table>";

switch($t)
{
//�Ѻ��Ҩҡ�����
case "send":

mysql_connect( $host,$username,$password) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������"); /* �ӡ�����͡�ҹ�����š�͹ */
// �ӿѧ���� Ramdom password �������͡�˹���������ͧ�ѹ��ë�ӡѹ
function random_password($len)
{
srand((double)microtime()*10000000);
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$ret_str = "";
$num = strlen($chars);
for($i = 0; $i < $len; $i++)
{
$ret_str.= $chars[rand()%$num];
$ret_str.="";
}
return $ret_str;
}
// echo random_password(Cool;
$passw = random_password(7);
$path="picture";
$filenewcon = strstr($file_name,'.');
$now = date("Dgis");
if(empty($file))
{
echo"��س����͡���";
}
else
{
copy( $file ,"$path/$passw$now$filenewcon");

$sql1= "INSERT INTO $tb (id,picture) VALUES ('','$passw$now$filenewcon')";
$dbquery1 = mysql_db_query($db, $sql1);
echo"Uploads ��������<br>";
echo"<a href='ryuozero.html?t=view'>����������</a><br>";
}

break;


//����ª������
case "view":

mysql_connect( $host,$username,$password) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������"); /* �ӡ�����͡�ҹ�����š�͹ */

$sql="Select * From $tb";

$db_query=mysql_db_query($db,$sql);
$num_rows=mysql_num_rows($db_query); /* �Ѻ Reccord ��辺 */
?>
<table width="41%" border="1" align="center">
<tr>
<td width="8%">
<div align="center">Id</div>
</td>
<td width="11%">
<div align="center">File Name</div>
</td>
</tr>
</table>
<?

$a=0;
while($a < $num_rows)
{
$result = mysql_fetch_array($db_query);
$id=$result[id];
$picture=$result[picture];

?>
<table width="41%" border="1" align="center">
<tr>
<td width="8%">
<div align="center">
<?echo"$id";?>
</div>
</td>
<td width="11%">
<div align="center"> <a href="picture/<?echo"$picture";?>" target="_blank">
<?echo"$picture";?>
</a></div>
</td>
</tr>
</table>
<?
$a++;
}
echo"<center><br>�ӹǹ Reccord = $num_rows</center>";
mysql_close();
echo"<a href='$PHP_SELF'>˹����ѡ</a><br>";

}
?

������������ҹ���Ũ��


�������ش�� ryuozero ����� Sat Oct 20, 2007 5:13 pm, ������ 3 ����
���仢�ҧ��
´Ù¢éÍÁÙÅÊèǹµÑÇ Ê觢éͤÇÒÁÊèǹµÑÇ Êè§ Email
ryuozero
Site Admin


�������: 13 Jul 2005
�ͺ: 1145

µÍºï¿½Íºï¿½ï¿½ï¿½ï¿½ï¿½: Sat Oct 20, 2007 5:09 pm    ï¿½ï¿½ï¿½ï¿½Í§: µÍºâ´ÂÍéÒ§¢éͤÇÒÁ

<?php
$host="localhost";
$username="root";
$pass_word="pass";
$db="uploadtest";
$tb="picture";

echo "<table width='98%' border='0' cellspacing='1' cellpadding='1'>";
echo "<tr>";
echo "<td><div align='center'> <font color='#FF0000'><strong>�к� test upload </strong></font></div>";
echo "<table width='50%' border='0' align='center' cellpadding='1' cellspacing='5'>";
echo "<tr>";
echo "<td>";
echo "<form name='form1' enctype='multipart/form-data' method='post' action='$PHP_SELF?t=send'>";
echo "���͡������ Uploads ";
echo "<input type='file' name='file' class='txt'>";
echo "<input type='submit' name='send' value='�ѻ��Ŵ���' class='bot'>";
echo "</form></td>";
echo "</tr>";
echo "</table></td>";
echo "</tr>";
echo "</table>";

switch($t)
{
//�Ѻ��Ҩҡ�����
case "send":

mysql_connect( $host,$username,$pass_word) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������"); /* �ӡ�����͡�ҹ�����š�͹ */
// �ӿѧ���� Ramdom password �������͡�˹���������ͧ�ѹ��ë�ӡѹ
function random_password($len)
{
srand((double)microtime()*10000000);
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$ret_str = "";
$num = strlen($chars);
for($i = 0; $i < $len; $i++)
{
$ret_str.= $chars[rand()%$num];
$ret_str.="";
}
return $ret_str;
}
// echo random_password(Cool;
$passw = random_password(7);
$path="picture";
$filenewcon = strstr($file_name,'.');
$now = date("Dgis");
if(empty($file))
{
echo"��س����͡���";
}
else
{
copy( $file ,"$path/$passw$now$filenewcon");

$sql1= "INSERT INTO $tb (id,picture) VALUES ('','$passw$now$filenewcon')";
$dbquery1 = mysql_db_query($db, $sql1);
echo"Uploads ��������<br>";
echo"<a href='ryuozero.html?t=view'>����������</a><br>";
}

break;


//����ª������
case "view":

mysql_connect( $host,$username,$password) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die("���͡�ҹ�����������"); /* �ӡ�����͡�ҹ�����š�͹ */

$sql="Select * From $tb";

$db_query=mysql_db_query($db,$sql);
$num_rows=mysql_num_rows($db_query); /* �Ѻ Reccord ��辺 */
?>
<table width="41%" border="1" align="center">
<tr>
<td width="8%">
<div align="center">Id</div>
</td>
<td width="11%">
<div align="center">File Name</div>
</td>
</tr>
</table>
<?

$a=0;
while($a < $num_rows)
{
$result = mysql_fetch_array($db_query);
$id=$result[id];
$picture=$result[picture];

?>
<table width="41%" border="1" align="center">
<tr>
<td width="8%">
<div align="center">
<?echo"$id";?>
</div>
</td>
<td width="11%">
<div align="center"> <a href="picture/<?echo"$picture";?>" target="_blank">
<?echo"$picture";?>
</a></div>
</td>
</tr>
</table>
<?
$a++;
}
echo"<center><br>�ӹǹ Reccord = $num_rows</center>";
mysql_close();
echo"<a href='$PHP_SELF'>˹����ѡ</a><br>";
}
?>
���仢�ҧ��
´Ù¢éÍÁÙÅÊèǹµÑÇ Ê觢éͤÇÒÁÊèǹµÑÇ Êè§ Email
���§�ӴѺ��ͤ����ͺ�ҡ��͹˹��:   
Forum ¹Õé¶Ù¡ÅçÍ¡ ¤Ø³äÁèÊÒÁÒöµÍº ËÃ×Íá¡éä¢ä´é   ËÑÇ¢é͹Õé¶Ù¡ÅçÍ¡ ¤Ø³äÁèÊÒÁÒöá¡éä¢ ËÃ×͵ͺä´é    ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Ö¡ï¿½ï¿½ -> +�+WEB+�+ ��Ѻ���� GMT
˹�� 1 �ҡ 1

 
价��:  
�س�������ö���ҧ��Ǣ������
�س�������ö�����ͺ
�س�������ö��䢢�ͤ����ͧ�س
�س�������öź��ͤ����ͧ�س
�س�������öŧ��ṹ


Powered by phpBB © 2001 phpBB Group
-- Template created by dav.bo=> PurpleStylus --


For Support - http://forums.BizHat.com

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!