22 พฤษภาคม 2555, 17:17:24
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: มาำทำเฟรมอัพโหลดสำเร็จรูปในบอร์ดกันครับ  (อ่าน 1799 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
  • ชื่อ: Upload Finished
  • ผู้เขียน: zelda
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: Feature Enhancement
  • รองรับ: SMF 1.1.xx
  • ปรับปรุงล่าสุด: 23 มิถุนายน 2553
  • ขอบคุณ: icez@f0nt, SvZ, Upic.me

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

ตัวอย่าง


สร้างไฟล์: ajaxredir.php
โค๊ด: [Select]
<?php

if ($_SERVER['REQUEST_METHOD'] != 'POST')
die("Invalid request");

$inputtype = isset($_GET['codetype']) ? $_GET['codetype'] : die("Invalid parameter [type].");
$linkmode = isset($_POST['codemode']) ? $_POST['codemode'] : 'full';
$form = isset($_GET['form']) ? $_GET['form'] : die("Invalid parameter [form].");
$field = isset($_GET['field']) ? $_GET['field'] : die("Invalid parameter [field].");

$type_supported = array('bbcode''html''tinymce');
if (!
in_array($inputtype$type_supported))
die("Invalid type parameter.");

$link_supported = array('thumb''full');
if (!
in_array($linkmode$link_supported))
$linkmode 'full';

if (!isset(
$_FILES['img']) || $_FILES['img']['error'] != 0)
die("File upload error!");

$tmp_name $_FILES['img']['tmp_name'];
$name $_FILES['img']['name'];
$type $_FILES['img']['type'];
$size $_FILES['img']['size'];

$errno 0;
$errstr "";
if (
$handle = @fsockopen("img.icez.net""80"$errno$errstr3)) {
$fp = @fopen($tmp_name"r") or die("Server error!");
$content = @fread($fpfilesize($tmp_name)) or die("Server error!");
@fclose($fp) or die("Server error!");

$boundstr "imgicezajax";
$bound "--".$boundstr;
$requestbody $bound."\r\nContent-Disposition: form-data; name=\"img\"; filename=\"".$name."\"\r\n";
$requestbody .= "Content-Type: ".$type."\r\n\r\n".$content."\r\n".$bound;
$header "POST /ajaxupload.php?codetype=".$inputtype."&codemode=".$linkmode."&form=".urlencode($form)."&field=".urlencode($field)."&host=".urlencode($_SERVER["HTTP_HOST"])." HTTP/1.0\r\n";
$header .= "Host: img.icez.net\r\n";
$header .= "User-Agent: icez/imgapi/100\r\n";
$header .= "X-IMG-REMOTEADDR: ".$_SERVER["REMOTE_ADDR"]."\r\n";
$header .= "X-IMG-REMOTEHOST: ".$_SERVER["HTTP_HOST"]."\r\n";
$header .= "Content-type: multipart/form-data; boundary=".$boundstr."\r\n";
$header .= "Content-length: ".strlen($requestbody)."\r\n";
$header .= "Connection: close;\r\n\r\n";

fwrite($handle$header);
fwrite($handle$requestbody);

unset($header$requestbody);
$content "";
while (!feof($handle)) {
$content .= fread($handle4096);
}
fclose($handle);
$strheader substr($content0strpos($content"\r\n\r\n"));
$content substr($contentstrpos($content"\r\n\r\n")+4);
echo("<script language=\"javascript\" type=\"text/javascript\">\n");
if (!eregi("HTTP/1.[0-1] 200"$strheader)) {
echo("alert('Server failure!');");
} else {
echo($content);
}
echo("history.back();");
echo("</script>");
} else {
die("API Connection error (".$errno.":".$errstr.")");
}
?>

สร้างไฟล์: ajaxform.php
โค๊ด: [Select]
<?php
$form 
= !empty($_GET['form']) ? $_GET['form'] : die("Invalid parameter [form].");
$field = !empty($_GET['field']) ? $_GET['field'] : die("Invalid parameter [field].");
$codetype = !empty($_GET['codetype']) ? $_GET['codetype'] : die("Invalid parameter [type].");
$codemode = isset($_GET['codemode']) ? $_GET['codemode'] : 'full';

$color = !empty($_GET['color']) ? $_GET['color'] : '';
if (!empty(
$color))
$color 'color: '.$color.';';
$type_supported = array('bbcode''html''tinymce');
if (!
in_array($codetype$type_supported))
die("Invalid type parameter.");
?>

<html>
<head>
<title>Upload API for webboard.</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
html, body {
background: #efefe6;
margin: 0;
padding: 0;
}
body, input {
font: 8pt Tahoma, sans-serif;
vertical-align: middle;
}
a:link, a:visited {
color: #444;
        text-decoration: none;
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form method="post" enctype="multipart/form-data" action="ajaxredir.php?form=<?php echo(urlencode($form)); ?>&field=<?php echo(urlencode($field)); ?>&codetype=<?php echo($codetype); ?>&codemode=<?php echo(urlencode($codemode));?>">
<div class="smalltext">
  เฉพาะ : jpg, jpeg, gif, png <b>จำกัดขนาด <span style="color:red">2</span> MB</b>
<input type="hidden" name="MAX_FILE_SIZE" value="1048576" />
<input type="file" name="img" class="input" size="15" />
<input type="submit" name="upload" value="อัพโลด!" class="input">
<br />
<label><input type="checkbox" name="codemode" value="thumb">thumbnail code</label>
<!-- Don't remove credit, Thanks -->
<div>
<span style="color:#888">ขอขอบคุณ <a href="http://upic.me" target="_blank">Upic.me</a></span>
</div></div>
</form>
</body>
</html>

อัพโหลดทั้งสองไฟล์นี้ขึ้นไปบนไดเรคทอรีของบอร์ด (ที่เดียวกับไฟล์ ssi)

แก้ไขไฟล์:

file post.template.php

ค้นหา -->>
โค๊ด: [Select]
// Finally, the submit buttons.

เพิ่มไว้ก่อน -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
jnarin

icon message
general ความคิดเห็นที่ 1 เมื่อ: 31 มกราคม 2553, 13:23:36
แจ๋วเลย

ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
***



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 2 เมื่อ: 8 เมษายน 2553, 21:50:05
ทำไมของผมเป็นแบบนี้ครับ แก้ไขตรงไหนครับ

Not Found
The requested URL /ajaxform.php?form=postmodify&field=message&codetype=bbcode was not found on this server. www.damkwan.com





ขอบคุณครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.6.3   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*


อยู่อย่างว่างเปล่า...หรือจะตายเพื่อบางสิ่ง

Thailand   ชาย ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 13 กุมภาพันธ์ 2554, 12:46:25
ทำไมของผมเป็นแบบนี้ครับ แก้ไขตรงไหนครับ

Not Found
The requested URL /ajaxform.php?form=postmodify&field=message&codetype=bbcode was not found on this server. www.damkwan.com





ขอบคุณครับ


...เป็นเหมือนกันครับ



ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.6.13   see ip บันทึกการเข้า
ดูรายการสิ่งของน้องหมี..เอาไว้กอดนอนแทนกิ๊ก  
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 4 เมื่อ: 13 กุมภาพันธ์ 2554, 13:21:56
รู้สึกว่าผู้ให้บริการรายนี้เขายกเลิกไปแล้วนะครับ

http://www.icez.net/blog/topics/php

ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.5.16   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 5 เมื่อ: 13 กุมภาพันธ์ 2554, 19:44:21

เว็บของพี่ไอซ์ยังเปิดให้บริการตามปกติอยู่ครับ http://upic.me

สำหรับคนที่ทำไม่ได้ เช็คพาธที่อยู่ของไฟล์ให้ถูกด้วยนะครับไฟล์ ajaxform, ajaxupload ตัวไฟล์อยู่ฝั่งเรา ไม่ได้ยุ่งเกี่ยวกับทางฝั่งเซิร์ฟเวอร์

ปล.ผมไม่แน่ใจนะครับว่าพี่ไอซ์เค้ามีการเปลี่ยนแปลง API ตัวนี้หรือเปล่า เห็นเว็บรีวิชั่นใหม่

ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows NT 6.1    Firefox 3.6.13   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
***



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 6 เมื่อ: 13 กุมภาพันธ์ 2554, 23:52:28
ผมทดสอบโชว์แล้วครับ แต่ ฟ้องว่า เชิฟเวอร์ล่มเหลว ครับ





ลิงค์หัวข้อ: http://dexmore.com/topic/284
Windows XP    Firefox 3.6.13   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 19 พฤษภาคม 2555, 18:07:41

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla