$_FILES

This is a discussion on "$_FILES" within the PHP Forum section. This forum, and the thread "$_FILES are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 10th, 2005, 09:59
Up'n'Coming Member
Join Date: Sep 2005
Location: athens
Age: 25
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
$_FILES

Hi all!

I have a question: I am constructing a form where the user can upload a file.
I need however to verify that the file uploaded is a TEXT file.

Is $_FILE['userfile']['type'] what I need? I am asking this because no matter if I upload a .txt or a .gif file, PHP says they are both $_FILE['userfile']['type']='text' and so, they are both uploaded on the server, whereas there should be only .txt file uploaded and not the .gif file.

In general, how can I allow only text files to be uploaded?
(Of course, i can't rely much on the extension I believe)..

Thanx
Reply With Quote

  #2 (permalink)  
Old Oct 10th, 2005, 16:08
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Code: Select all
$_FILE['userfile']['type'] == 'text'
Reply With Quote
  #3 (permalink)  
Old Oct 12th, 2005, 13:04
Up'n'Coming Member
Join Date: Sep 2005
Location: athens
Age: 25
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Thanx! Silly mistake..
Reply With Quote
  #4 (permalink)  
Old Oct 12th, 2005, 13:26
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
No problem
We all do them.
Reply With Quote
Reply

Tags
_files

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:44.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43