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,030

HOME > PHP > PHP Forum > ช่วยดูให้หน่อยครับเกี่ยวกับ upload มัน error อะครับ พี่คนใหนพอมี code เกี่ยวกับการ upload ไฟล์ข้อมูล



 

ช่วยดูให้หน่อยครับเกี่ยวกับ upload มัน error อะครับ พี่คนใหนพอมี code เกี่ยวกับการ upload ไฟล์ข้อมูล

 



Topic : 018721

Guest




มัน error อะครับ พี่คนใหนพอมี code เกี่ยวกับการ upload ไฟล์ข้อมูล ช่วยบอกทีครับ

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /usr/home/phaisand/domains/banbung-stationery.com/public_html/download/showimg.php on line 13

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /usr/home/phaisand/domains/banbung-stationery.com/public_html/download/showimg.php on line 14

ขอบคุณล่วงหน้าครับ


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 4 มี.ค. 2551 19:15:42 By : LIGHT View : 1395 Reply : 1
 

 

No. 1



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



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

The database contains one table, ?file_manager? that manages file information.
The sql statement for creating the table:
CREATE TABLE file_manager (file_name varchar(50) default NULL, file_type varchar(20) NOT NULL default '', file_size
varchar(20) NOT NULL default '', file_modified varchar(20) NOT NULL default '', file_parent_id mediumint(9) default
NULL, file_image_name varchar(50) default NULL,
KEY file_name (file_name), KEY file_image_name (file_image_name)) TYPE=MyISAM;
File Management:
I?ve written two programs to manage this file version. The first to upload the file (file_upload_manager.php), the second is
to display the file (file_display_manager.php). The source code is tested on a Windows system.
Note: Linux users, please change the folder path accordingly.
File Upload Manager:
This program displays a menu to select the file in your system, a check box and an Upload button.
Once the user clicks the upload button, the program checks the file for existence, and undergoes a series of tests as
described in the plan.
Now let?s look upon the code snippets used in the program.
$dir_path Variable:
This variable is the destination folder path.
$dir_path= "C:apachehtdocsfilemanager";
This path is given for Windows-based systems. Please change your destination folder accordingly.
Get_New_File_Name() Function:
This function is called from the main program when the program encounters file exists and difference in size, date or
time. This function will generate a new file name and return to the main function.
function Get_New_FIle_Name($file_name){
$sqlQuery="SELECT file_image_name FROM file_manager WHERE file_name LIKE '$file_name%' AND
http://www.devarticles.com - Dev Articles Powered by Mambo Open Source Generated: 4 March, 2008, 11:17

file_parent_id=1";
$fResult=mysql_query($sqlQuery); $Last_Version=0; $ver=0;
if(mysql_num_rows($fResult)){ while($fRow=mysql_fetch_array($fResult)){
list($junk,$ver)=explode("_VERSION",$fRow['file_image_name']); list($ver,$extn)=explode(".",$ver); $Last_Version =
$Last_Version > $ver ? $Last_Version : $ver; } }else{ $new_file_name =$file_name."_VERSION".++$Last_Version;
return $new_file_name; }
if($Last_Version !=0){ $new_file_name=$file_name."_VERSION".++$Last_Version; return $new_file_name; }}
The sql query in the beginning of the function will fetch file names of previous versions.
If the sql query returns record sets, it means the file has previous versions. The while loop is executed to store the
generated version number, and the value obtained is stored in $Last_Version. Otherwise, the new file name will be
generated as file-name_VERSION1.
The next if statement checks for $Last_Version != 0, if true, $Last_Version is incremented by 1 and a new file name is
assigned.
The return statement will return a new file name generated to the called statement.
File_Size() Function:
This function returns the file size in terms of Bytes, Kb or Mb.
<?function File_Size($size){ if($size > 104876){ return $return_size=sprintf("%01.2f",$size / 104876)." Mb"; }elseif($size
> 1024){ return $return_size=sprintf("%01.2f",$size / 1024)." Kb"; }else{ return $return_size=$size." Bytes"; }
}?>
Display_form() Function:
This function is used to prompt the user to select the file from your local machine.
<?function display_form($errMsg){ global $dir_path;
?><html><head><title>File Manager</title></head><body bgcolor="#E5E5E5"><div align="center"><h4>File
Manager</h4>
<? if($errMsg){?><font face="verdana, helvetica" size="2" color="red"><? echo $errMsg ?></font><?} ?><form
action="<? echo $PHP_SELF; ?>" enctype="multipart/form-data" method="POST"><table border="1"><tr><th>File
Location:</th><th><input type="file" name="up_file" /></th></tr><tr><th colspan="2"><br><input type="checkbox"
name="replace" value="1">Replace Exiting File*</th></tr><tr><th colspan="2"><br><input type="submit" name="upload"
value="Upload File !" /></th></tr></table>
<br>* - Clicking this option will replace the existing file<br><a href="file_display_manager.php">File Manager</a>






Date : 4 มี.ค. 2551 23:23:39 By : arsachi
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูให้หน่อยครับเกี่ยวกับ upload มัน error อะครับ พี่คนใหนพอมี code เกี่ยวกับการ upload ไฟล์ข้อมูล
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 05
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 อัตราราคา คลิกที่นี่