To get started immediately make a reservation, this example will only work in php version 4.0.3 and higher.
It turns out it is because of the use of two new features
move_uploaded_file () and is_uploaded_file ().
But believe me, it's worth, and php still desirable to update.
So the code php script is as follows:
Consider who and what we have here means:
$ user_file - this variable (a name taken from a form) contains a path to a temporary file that we upload to the server.
By attachment to the variable
suffixes _name, _size, _type, and we can get additional information.
For example:
$ user_file_name - the original file name.
$ user_file_size - file size in bytes.
$ user_file_type - mime type of file, such as "image / gif".
is_uploaded_file () - returns true or false, and is used to verify the correctness of the transmitted file.
So for example if the file does
transmitted to us through http post, you will get true.
But otherwise, like if you tried to convey that something is not right, such as combination of
Parameters for / etc / passwd - you will get false.
move_uploaded_file () - function moves the temporary file in there, where we provide.
The first option - that move, the second option - to
move it.