By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

Detect uploaded files

P: 58
Good morning everyone !

I have a form with an upload section.Currently the form submits user input as normal(direct into database).I want if they upload some file,the file is detected and then they are sent a confirmation email instead.If no file uploaded ,they get a thank you page(as it is now) .This is to at least have some control in the uploads,as am getting some garbage uploads,leaving an upload form sitting vulnerable like that.
I hope if someone can share me the insight of how it can be done.
My gratitude in advance !
May 30 '07 #1
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
This is to at least have some control in the uploads,as am getting some garbage uploads,leaving an upload form sitting vulnerable like that.
I hope if someone can share me the insight of how it can be done.
You'll be wanting to analyze your $_FILES array.
May 30 '07 #2

P: 58
Can you please elaborate on this a bit more ?
May 30 '07 #3

pbmods
Expert 5K+
P: 5,821
Can you please elaborate on this a bit more ?
Sure. When you upload a file to a PHP script, PHP automatically stores information about the uploaded file in a superglobal array called $_FILES.

For more information, take a look at this page:
http://us2.php.net/features.file-upload

To take a look at your entire $_FILES array at a glance, simply include this code:

Expand|Select|Wrap|Line Numbers
  1. header('Content-type: text/plain');
  2. var_dump($_FILES);
  3. exit;
  4.  
May 30 '07 #4

P: 58
Thank you very much !
This will surely get me started
off to implementation
May 30 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.