ต้องการกำหนด การ 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
ต้องการกำหนด การ Upload ไฟล์ใน PHP อย่างไรครับ??
Moderator: mindphp, ผู้ดูแลกระดาน
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41117
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
เช็คด้วย
$_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
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ upload file ในภาษา Python ใช้สำหรับ upload ไฟล์ต่างๆ มาใช้งาน
โดย jirawoot » 09/07/2019 4:46 pm » ใน Python Knowledge - 0 ตอบกลับ
- 4223 แสดง
-
โพสต์ล่าสุด โดย jirawoot
09/07/2019 4:46 pm
-
-
-
โพสต์ใหม่ Upload Joomla_3.10.11 แล้วรันหน้าเว็บไม่ขึ้น
โดย noncup302 » 01/02/2023 6:53 pm » ใน สอบถามปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS, CRM - 6 ตอบกลับ
- 863 แสดง
-
โพสต์ล่าสุด โดย noncup302
08/02/2023 6:17 pm
-
-
-
โพสต์ใหม่ การ Upload package file
โดย Chanida Kongduang » 05/10/2017 6:58 pm » ใน Joomla Development - 1 ตอบกลับ
- 1571 แสดง
-
โพสต์ล่าสุด โดย tsukasaz
05/10/2017 9:41 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 49