ต้องการกำหนด การ Upload ไฟล์ใน PHP อย่างไรครับ??

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

นายปุ๊ก (c)

ต้องการกำหนด การ Upload ไฟล์ใน PHP อย่างไรครับ??

โพสต์ที่ยังไม่ได้อ่าน โดย นายปุ๊ก (c) »

ต้องการกำหนด การ Upload ไฟล์ใน PHP อย่างไรครับ??
- ผมได้เขียนโปรแกรม PHP เพื่อให้ผู้ใช้สามารถ Upload (ฺBrowse) ไฟล์ไปไว้ที่เครื่อง Server แต่ ...
- แต่ผมไม่ทราบว่าจะเขียนโปรแกรม PHP อย่างไร??? เพื่อกำหนดว่า ต้องการ Upload ไฟล์
-.doc (Word)
- .xls (Excel)
-. ppt (PowerPoint)
- .pdf (Acobat)
- .txt (Text File)
-.jpg (รูปภาพ)
-.gif (รูปภาพ)
--- ซึ่งผมจะกลัวว่าผู้ใช้ได้ Upload ไฟล์จำพวก หนัง หรือ ไฟล์พวก .exe หรือ ไฟล์อื่น ๆ ที่ผมไม่ต้องการเข้าไปอยุ่ใน Server นะครับ...
-- ผมขอความกรุณาช่วยผมด้วยนะครับ ผมเขียนไม่ถูกจริง ๆ เลยนะครับ

จากคุณ : เด็กเพิ่งหัดเขียน PHP
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41117
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »


เช็คด้วย
$_FILES['userfile']['type'] ก็ จะรู้ ว่า ไฟล์ ที่ user up มามี type ไหน

ความรู้เพิม เติม

The global $_FILES exists as of PHP 4.1.0 (Use $HTTP_POST_FILES instead if using an earlier version). These arrays will contain all the uploaded file information.

The contents of $_FILES from the example form is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. This can be any name.

$_FILES['userfile']['name']

The original name of the file on the client machine.
$_FILES['userfile']['type']

The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
$_FILES['userfile']['size']

The size, in bytes, of the uploaded file.
$_FILES['userfile']['tmp_name']

The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES['userfile']['error']

The error code associated with this file upload. This element was added in PHP 4.2.0
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 49