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 : 105700



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



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




ผมมีไฟล์ อยู่ 2 ไฟล์ครับ คือไฟล์ upfileform.php เป็นหน้าฟอร์มอัพโหลด และ upfileshow.php เป็นหน้าโชว์ผลงาน ซึ่งมันจะเป็นลิงค์เดียวกันครับ

จุดประสงค์ก็คือ ไอดี 1 ล๊อคอินเข้าสู่ระบบ ถ้ากดลิงค์จัดการข้อมูลผลงานนะครับ ถ้าไอดี 1 ยังไม่มีไฟล์อัพโหลดอยู่ในระบบเลย จะให้มันไปที่หน้า upfileform.php เพื่ออัพโหลดไฟล์เข้าไอดีนี้ครับ เมื่อไอดี 1 มาคลิกที่ลิงค์นี้ครั้งต่อไปจะให้มันไปที่หน้า upfileshow.php จะต้องทำยังไงหรอครับ

upfileform.php (PHP)
<? @session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
	<form name="form1" method="post" action="index.php?home=upfilecomplete" enctype="multipart/form-data">
	  <br>
     <table width="50%" border="0" align="center" cellpadding="2" cellspacing="1">
      <tr>
        <td colspan="3"><div align="center">อัพโหลดข้อมูลผลงาน</div></td>
       </tr>
       <tr>
        <td colspan="3"><div align="center">
          <p>&nbsp;</p>
        </div></td>
       </tr>
      <tr>
        <td width="29%">ชื่อไฟล์</td>
        <td width="2%">:</td>
        <td width="69%"><input type="text" name="txtName" maxlength="100" /></td>
      </tr>
      <tr>
        <td>เลือกไฟล์</td>
        <td>:</td>
        <td><input type="file" name="filUpload" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><input name="btnSubmit" type="submit" value="บันทึก" /></td>
      </tr>
    </table>
	</form>
</body>
</html>


upfileshow.php(PHP)
<? @session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
	margin-top: 0px;
}
</style>
</head>

<body>

<?
	$id_pic = $_SESSION['id1'];
	$strSQL = "SELECT * FROM works WHERE id_pic = $id_pic";
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	$Num_Rows = mysql_num_rows($objQuery);
	
					$Per_Page = 11;

					$Page = $_GET["Page"];
					if(!$_GET["Page"])
					{
						$Page=1;
					}

						$Prev_Page = $Page-1;
						$Next_Page = $Page+1;

					$Page_Start = (($Per_Page*$Page)-$Per_Page);
					if($Num_Rows<=$Per_Page)
					{
						$Num_Pages =1;
					}
					else if(($Num_Rows % $Per_Page)==0)
					{
						$Num_Pages =($Num_Rows/$Per_Page) ;
					}
						else
					{
						$Num_Pages =($Num_Rows/$Per_Page)+1;
						$Num_Pages = (int)$Num_Pages;
					}
					
					$strSQL.=" order by FilesID ASC LIMIT $Page_Start , $Per_Page";
					$result_show  = mysql_query($strSQL);
					while($objResult = mysql_fetch_array($result_show))
					{
?>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="index.php?home=upfileform&id">เพิ่มผลงาน</a></td>
  </tr>
</table>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<th width="554" bgcolor="#999999"> <div align="center">ชื่อผลงาน | เกียรติบัตร | วิจัย</div></th>
<th colspan="2" bgcolor="#999999">จัดการข้อมูล</th>
</tr>
<?
	while($objResult = mysql_fetch_array($result_show))
	{
		
?>
<tr>
<td bgcolor="#CCCCCC"><center><a href="uploadfile/myfile/<?=$objResult["FilesName"];?>"><?=$objResult["Name"];?></a></center></td>
<td width="148" bgcolor="#CCCCCC"><div align="center"><a href="index.php?home=deleteworks&FilesID=<?=$objResult["FilesID"];?>" onclick="return confirm('คุณกำลังลบไฟล์ แน่ใจหรือว่าคุณต้องการที่จะลบไฟล์นี้')">ลบ</a></div></td>
</tr>
<?
	}}
?>
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center"><br>
    
	<?
	if($Prev_Page)
	{
		echo " <a href='index.php?home=upfileshow&Page=$Prev_Page&id'><< Back</a> ";
	}

	for($i=1; $i<=$Num_Pages; $i++){
		if($i != $Page)
		{
			echo "[ <a href='index.php?home=upfileshow&Page=$i&id'>$i</a> ]";
		}
		else
		{
			echo "<b> $i </b>";
		}
	}
	if($Page!=$Num_Pages)
	{
		echo " <a href ='index.php?home=upfileshow&Page=$Next_Page&id'>Next>></a> ";
	}
	?>
</div></td>
  </tr>
</table>
<p>&nbsp;</p>

<?
mysql_close();
?>
</body>
</html>


ส่วนนี้เป็นไฟล์ index ใช้สำหรับกำหนดลิงค์ครับ ลิงค์จะอยู่ตรงบรรทักที่ 238
index.php (PHP)
<? @session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
	background-image: url(images/bgbg.png);
	margin-top: 0px;
}
</style>
</head>
<body leftmargin="10" marginwidth="10">
<table width="68%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="7%"><img src="images/e-portfolio_01.png" alt="" width="68" height="15" /></td>
        <td width="1%"><img src="images/e-portfolio_02.png" width="10" height="15" alt="" /></td>
        <td colspan="2"><img src="images/e-portfolio_03.png" width="867" height="15" alt="" /></td>
        <td width="1%"><img src="images/e-portfolio_04.png" width="14" height="15" alt="" /></td>
        <td width="6%"><img src="images/e-portfolio_05.png" width="61" height="15" alt="" /></td>
      </tr>
      <tr>
        <td><img src="images/e-portfolio_06.png" width="68" height="237" alt="" /></td>
        <td><img src="images/e-portfolio_07.png" width="10" height="237" alt="" /></td>
        <td colspan="2" bgcolor="#FFFFFF"><img src="images/e-portfolio_08.png" width="867" height="237" alt="" /></td>
        <td><img src="images/e-portfolio_09.png" width="14" height="237" alt="" /></td>
        <td><img src="images/e-portfolio_10.png" width="61" height="237" alt="" /></td>
      </tr>
      <tr>
        <td background="images/e-portfolio_11.png"></td>
        <td background="images/e-portfolio_12.png"></td>
        <td width="25%" bgcolor="#CCCCCC">
        <?
        include ('includes/config.php');
		?>
		<? if ($_SESSION['log'] == 'LOGIN'){  ?>        
		
		  <table width="100%" border="0" cellspacing="5" cellpadding="0">
            <tr>
              <td colspan="3" bgcolor="#009900"><div align="center" style="font-size: 16pt; font-weight: bold; font-family: 'Browallia New';">ยินดีต้อนรับเข้าสู่ระบบ</div></td>
            </tr>
            <tr>
              <td width="31%" style="font-family: 'TH Sarabun New'; font-size: 16pt;"><div align="right">คุณ</div></td>
              <td width="4%">:</td>
              <td width="65%"><? echo "$_SESSION[adminname]";?><? echo "$_SESSION[name]";?></td>
            </tr>
            <tr>
              <td style="font-size: 16pt; font-family: 'TH Sarabun New';"><div align="right">สถานะ</div></td>
              <td>:</td>
              <td><? if ($_SESSION[type_id] == '1') { echo "Administrator"; }elseif ($_SESSION[type_id] == '0') { echo "นักศึกษา"; } elseif ($_SESSION[type_id] == '2') {echo "อาจารย์";} ?></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td><div align="left"><a href="logout.php">ออกจากระบบ</a></div></td>
            </tr>
          </table>
          
                              
       <? }else{ ?>       
       <form id="form1" name="form1" method="post" action="member/login.php?op=LOG" >
		  <table width="100%" border="0" cellspacing="5" cellpadding="0">
            <tr>
              <td colspan="3" bgcolor="#009900"><div align="center" style="font-size: 16pt; font-weight: bold; font-family: 'Browallia New';">กรุณาเข้าสู่ระบบ</div></td>
            </tr>
            <tr>
              <td width="23%" style="font-family: 'TH Sarabun New'; font-size: 16pt;">Username</td>
              <td width="3%">:</td>
              <td width="74%"><input type="text" name="user" id="user" /></td>
            </tr>
            <tr>
              <td style="font-size: 16pt; font-family: 'TH Sarabun New';">Password</td>
              <td>:</td>
              <td><input type="password" name="pass" id="pass" /></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td><input type="submit" name="button" id="Submit" value="เข้าสู่ระบบ" />
                <input type="reset" name="button2" id="button" value="clear" /></td>                
            </tr>
          </table>
      </form> <? } ?>
      
        <td width="60%" rowspan="3" valign="top" bgcolor="#FFFFFF"><p>
          <?
		switch ($_GET[home]) {
			
							case register:
							include ("member/register.php");
							break;
							case management:
							include ("member/management.php");
							break;
							case login:
							include ("member/login.php");
							break;
							case logout:
							include ("logout.php");
							break;
							case editprofile:
							include ("member/editprofile.php");
							break;
							case edit:
							include ("member/edit.php");
							break;
							case search:
							include ("search.php");
							break;
							case saveprofile:
							include ("member/saveprofile.php");
							break;
							case showprofile:
							include ("member/showprofile.php");
							break;
							case upfileform:
							include ("uploadfile/upfileform.php");
							break;
							case upfilecomplete:
							include ("uploadfile/upfilecomplete.php");
							break;
							case upfileshow:
							include ("uploadfile/upfileshow.php");
							break;
							case createalbum:
							include ("activity/create_album.php");
							break;
							case creategallery:
							include ("activity/create_gallery.php");
							break;
							case deletealbum:
							include ("activity/delete_album.php");
							break;
							case deletegallery:
							include ("activity/delete_gallery.php");
							break;
							case editalbum:
							include ("activity/edit_album.php");
							break;
							case editgallery:
							include ("activity/edit_gallery.php");
							break;
							case savealbum:
							include ("activity/save_album.php");
							break;
							case savegallery:
							include ("activity/save_gallery.php");
							break;
							case showalbum:
							include ("activity/show_album.php");
							break;
							case showgallery:
							include ("activity/show_gallery.php");
							break;
							case updatealbum:
							include ("activity/update_album.php");
							break;
							case updategallery:
							include ("activity/update_gallery.php");
							break;
							case uploadgallery:
							include ("activity/upload_gallery.php");
							break;
							case viewalbum:
							include ("activity/view_album.php");
							break;
							case deleteworks:
							include ("uploadfile/deleteworks.php");
							break;
							case showupload:
							include ("uploadfile/showupload.php");
							break;
							case activityshow:
							include ("activity/activityshow.php");
							break;
							case activitygalery:
							include ("activity/activitygalery.php");
							break;
							case del:
							include ("member/del.php");
							break;
							
						default:
						{
							include("home.php");
						break;}
						}
						
				
        ?>
        </p></td>
        <td background="images/e-portfolio_14.png"></td>
        <td background="images/e-portfolio_15.png"></td>
      </tr>
      <tr>
        <td background="images/e-portfolio_11.png"></td>
        <td background="images/e-portfolio_12.png"></td>
        <td bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="5" cellpadding="0">
          <tr>
            <td bgcolor="#009900"><div align="center" style="font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;">เมนูหลัก</div></td>
            </tr>
        </table></td>
        <td background="images/e-portfolio_14.png"></td>
        <td background="images/e-portfolio_15.png"></td>
      </tr>
      <tr>
        <td background="images/e-portfolio_11.png"></td>
        <td background="images/e-portfolio_12.png"></td>
        <td valign="top" bgcolor="#CCCCCC"><table width="100%" border="0" cellpadding="0" cellspacing="5">
          <tr>
            <td style="text-align: left; font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;"><div align="center"><a href="index.php">หน้าแรก</a></div></td>
          </tr>
          <tr>
            <td style="text-align: left; font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;"><div align="center">
            
			<? if ($_SESSION['type_id'] == '0') {
				
				echo "<a href=\"index.php?home=editprofile\">แก้ไขข้อมูลส่วนตัว</a> ";
				
				}
				
				if ($_SESSION['type_id'] == '1'){ 
				echo "<a href=\"index.php?home=management\">จัดการข้อมูลนักศึกษา</a>"; 
				}
				
				if ($_SESSION['type_id'] == '2'){ 
				echo "<a href=\"index.php?home=search\">ค้นหาและดูข้อมูลนักศึกษา</a>";
				}
			?>
			</div></td>
          </tr>
          <tr>
            <td style="text-align: center; font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;">
               <? if ($_SESSION['type_id'] == '0'){ 
				echo "<a href=\"index.php?home=upfileshow&id\">จัดการข้อมูลผลงาน</a>";
			}?>
				</td>
          </tr>
          <tr>
            <td style="text-align: center; font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;"> 
			<? if ($_SESSION['type_id'] == '0'){ 
				echo "<a href=\"index.php?home=viewalbum&id\">จัดการข้อมูลกิจกรรม</a>";
			}?></td>
          </tr>
          <tr>
            <td style="text-align: center; font-family: 'Browallia New'; font-size: 16pt; font-weight: bold;">
			<? if ($_SESSION['type_id'] == '0'){
				echo "<a href=\"index.php?home=search\">ค้นหาและดูสมาชิก</a>";
			}?></td>
          </tr>
         
        </table>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p></td>
        <td background="images/e-portfolio_14.png"></td>
        <td background="images/e-portfolio_15.png"></td>
      </tr>
      <tr>
        <td background="images/e-portfolio_11.png"></td>
        <td background="images/e-portfolio_22.png"></td>
        <td colspan="2" bgcolor="#FFFFFF"><img src="images/e-portfolio_23.png" width="867" height="133" alt="" /></td>
        <td background="images/e-portfolio_24.png"></td>
        <td background="images/e-portfolio_15.png"></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>




Tag : PHP









ประวัติการแก้ไข
2014-02-11 09:14:45
2014-02-11 09:15:06
2014-02-11 09:18:53
2014-02-11 09:19:18
2014-02-11 09:20:24
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-02-11 09:13:48 By : wergill View : 950 Reply : 2
 

 

No. 1



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

Hall of Fame 2012

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


Code (PHP)
<?php
	$Username=mysql_real_escape_string($_POST['txtUsername']);
	$Password=mysql_real_escape_string($_POST['txtPassword']);
	$select=mysql_query("select * from example WHERE Username='".$Username."' AND Password=='".$Password."'") or die (mysql_error());
	$num_row=mysql_num_rows($select);
	if($num_row == 1){
		$Member=mysql_fetch_array($select);
		$_SESSION['Username']=$Member['Username'];
		$File=$Member['File'];
		if($File == ''){
			header('location:upfileform.php');
		}else{
			header('location:upfileshow.php');
		}
	}else{
		echo "<script>alert('$Username ไม่มีอยู่ในระบบ');</script>";
	}
?>









ประวัติการแก้ไข
2014-02-11 09:27:03
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-11 09:26:20 By : Ex-[S]i[L]e[N]t
 


 

No. 2



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



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


ขอบคุณมากครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-11 09:55:48 By : wergill
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
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 01
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 อัตราราคา คลิกที่นี่