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

need for using is_uploaded_file() function while uploading in php

P: 49
hello eveybody,

what is the actual need of usingfunction is_uploaded_file($_FILES["userfile"]["te mp_name"] ,

I know it return turn if the file was uploaded via http ,and false otherwise.

If i would not this function ,even then we can upload file successfully.
I guess some security reason behind this.

So please help me out in this regard.

Thank you
May 1 '10 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 5,058

That function is meant to verify that a file was uploaded via a HTTP request. If you are using the move_uploaded_file function to move the uploaded file before using it, this function is not needed. It's primarily used in cases where the temporary location of the uploaded file needs to be used in your code.

For example, if a data file is uploaded, so that it's contents can be saved into a database, after which the file itself is discarded, then in makes little sense to actually move the file before using it. The code would verify that the file was indeed uploaded, using this function, read it's content's from the temporary location, and then just delete it.
May 1 '10 #2

P: 49
Thank you Atli
I got your point,
Now I am sure when to use this function.

Great reply
Thank you
May 3 '10 #3

Post your reply

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