Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ผมต้องการ อัพโหลดรูปแล้ว จะเขียนคำสั่งให้รูปเข้ามาอยู่ในโฟล์เดอร์เว็บยังไงครับ



 

ผมต้องการ อัพโหลดรูปแล้ว จะเขียนคำสั่งให้รูปเข้ามาอยู่ในโฟล์เดอร์เว็บยังไงครับ

 



Topic : 112049



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์




ผมต้องการที่จะ อัพโหลดภาพแล้ว จะมีการ ปรับขนาดภาพอัตโนมัติ และ เก็บลงในโฟรเดอร์ img ครับ



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-10-20 02:46:58 By : peekungbaba View : 1737 Reply : 1
 

 

No. 1



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์


นี้โค๊ดครับ
Code (PHP)
<?php session_start(); ?>
<?php require_once('Connections/DbConnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE member SET al_name=%s, al_lastname=%s, address=%s, province=%s, district=%s, subdistrict=%s, zipcode=%s, tel=%s, email=%s, workplace=%s, position=%s, `pic`=%s WHERE al_no=%s",
                       GetSQLValueString($_POST['al_name'], "text"),
                       GetSQLValueString($_POST['al_lastname'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['province'], "text"),
                       GetSQLValueString($_POST['district'], "text"),
                       GetSQLValueString($_POST['subdistrict'], "text"),
                       GetSQLValueString($_POST['zipcode'], "text"),
                       GetSQLValueString($_POST['tel'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['workplace'], "text"),
                       GetSQLValueString($_POST['position'], "text"),
					   GetSQLValueString($_POST['pic'], "text"),
                       GetSQLValueString($_POST['al_no'], "text"));

  mysql_select_db($database_DbConnect, $DbConnect);
  $Result1 = mysql_query($updateSQL, $DbConnect) or die(mysql_error());

  $updateGoTo = "profile.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset1 = "SELECT * FROM member";
$Recordset1 = mysql_query($query_Recordset1, $DbConnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset2 = "SELECT * FROM province";
$Recordset2 = mysql_query($query_Recordset2, $DbConnect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset3 = "SELECT * FROM district";
$Recordset3 = mysql_query($query_Recordset3, $DbConnect) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset4 = "SELECT * FROM amphur";
$Recordset4 = mysql_query($query_Recordset4, $DbConnect) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);

$colname_showmembers = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_showmembers = $_SESSION['MM_Username'];
}
mysql_select_db($database_DbConnect, $DbConnect);
$query_showmembers = sprintf("SELECT * FROM member WHERE al_no = %s", GetSQLValueString($colname_showmembers, "text"));
$showmembers = mysql_query($query_showmembers, $DbConnect) or die(mysql_error());
$row_showmembers = mysql_fetch_assoc($showmembers);

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theVaslue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
  <title>editRegister</title>
<my sql_query("Set NAMES UTF8")
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="css/style.css">
  <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">    
  <link rel="stylesheet" type="text/css" href="css/form.css" />
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/bootstrap-theme.css"> 
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="phonegap.js"></script> 
<script src="jquery.mobile-1.3.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>


</head>




<body>
  



<nav class="navbar navbar-inverse" role="navigation">

<div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li><a href="#contact"></a></li>
            <li class="active"><a href="#">หน้าหลัก</a></li>
            <li><a href="#contact">เกี่ยวกับเรา</a></li>
            <li><a href="#contact">เว็บบอร์ด</a></li>
            <li><a href="#contact">กิจกรรม</a></li>
          </ul>

          <form action="logout.php" methord="get" class="navbar-form navbar-right" role="form">
            <div class="form-group">
            <FONT COLOR=WHITE> Hello <?php echo $row_showmembers['al_gender']; ?>.<?php echo $row_showmembers['al_name']; ?> </FONT>

            <button type="submit" class="btn btn-default">Logout</button>
          </form>


  </div>

</nav>
</div>



  
<center> <img src= "photo/img-01.jpg"> </center>


<!--  ====================================================================================================================================== -->



<h2 class="page-header">Profile</h2>


<center>


 <div class="bs-example">
    

<br></br>
      <div class="col-sm-6 col-md-4">

          <div><img src="img/<?php echo $row_showmembers['pic']; ?>" width="163" height="257" border="0" /></div>
       
      </div>
</center>
          


      <div class="col-sm-6 col-md-5">
        <div class="thumbnail">
          <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
            <table align="center">
              <tr valign="baseline">
                <td nowrap align="right">เลขทะเบียน:</td>
                <td><?php echo $row_showmembers['al_no']; ?></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">ชือ:</td>
                <td><input type="text" name="al_name" value="<?php echo htmlentities($row_showmembers['al_name'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">นามสกุล:</td>
                <td><input type="text" name="al_lastname" value="<?php echo htmlentities($row_showmembers['al_lastname'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">ที่อยู่:</td>
                <td><input type="text" name="address" value="<?php echo htmlentities($row_showmembers['address'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">จังหวัด:</td>
                <td><label for="province"></label>
                  <select name="province" id="province">
                    <option value="-">เลือกจังหวัด</option>
                    <?php
do {  
?>
                    <option value="<?php echo $row_Recordset2['PROVINCE_NAME']?>"><?php echo $row_Recordset2['PROVINCE_NAME']?></option>
                    <?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
  $rows = mysql_num_rows($Recordset2);
  if($rows > 0) {
      mysql_data_seek($Recordset2, 0);
	  $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  }
?>
                </select></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">เขต:</td>
                <td><label for="district"></label>
                  <select name="district" id="district">
                    <option value="-">เลือกเขต</option>
                    <?php
do {  
?>
                    <option value="<?php echo $row_Recordset4['AMPHUR_NAME']?>"><?php echo $row_Recordset4['AMPHUR_NAME']?></option>
                    <?php
} while ($row_Recordset4 = mysql_fetch_assoc($Recordset4));
  $rows = mysql_num_rows($Recordset4);
  if($rows > 0) {
      mysql_data_seek($Recordset4, 0);
	  $row_Recordset4 = mysql_fetch_assoc($Recordset4);
  }
?>
                  </select></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">แขวง:</td>
                <td><label for="subdistrict"></label>
                  <select name="subdistrict" id="subdistrict">
                    <option value="-">เลือกแขวง</option>
                    <?php
do {  
?>
                    <option value="<?php echo $row_Recordset3['DISTRICT_NAME']?>"><?php echo $row_Recordset3['DISTRICT_NAME']?></option>
                    <?php
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
  $rows = mysql_num_rows($Recordset3);
  if($rows > 0) {
      mysql_data_seek($Recordset3, 0);
	  $row_Recordset3 = mysql_fetch_assoc($Recordset3);
  }
?>
                  </select></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">รหัสไปรษณีย์:</td>
                <td><input type="text" name="zipcode" value="<?php echo htmlentities($row_showmembers['zipcode'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">เบอรืโทรศัพท์:</td>
                <td><input type="text" name="tel" value="<?php echo htmlentities($row_showmembers['tel'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">E-mail:</td>
                <td><input type="text" name="email" value="<?php echo htmlentities($row_showmembers['email'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">สถานที่ทำงาน:</td>
                <td><input type="text" name="workplace" value="<?php echo htmlentities($row_showmembers['workplace'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">ตำแหน่งงาน:</td>
                <td><input type="text" name="position" value="<?php echo htmlentities($row_showmembers['position'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">เปลี่ยนรูปภาพ:</td>
                <td><input type="file" name="file" /></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><input type="submit" value="ยืนยัน"></td>
              </tr>
            </table>
            <input type="hidden" name="MM_update" value="form1">
            <input type="hidden" name="al_no" value="<?php echo $row_showmembers['al_no']; ?>">
          </form>
          <p>&nbsp;</p>
        </div>
   </div>
</div>
  </div>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function (){
  $(".tool").tooltip();
});

</script>

</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset4);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);
?>








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-10-20 02:47:53 By : peekungbaba
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ผมต้องการ อัพโหลดรูปแล้ว จะเขียนคำสั่งให้รูปเข้ามาอยู่ในโฟล์เดอร์เว็บยังไงครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่