Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to understand php upload tutorial

Status
Not open for further replies.

csphard

Programmer
Apr 5, 2002
194
0
0
US
I am looking at several tutorials trying to understand how to do this
One is at this link.

The question I have is what part actually uploads it.

<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>

Howard
 
Actually none. By the time PHP gets to the file its already been uploaded.

The upload is performed by the HTML form and the browser.
It sends the file up to the server, and then PHP just works with it.

Your code just displays the information from the uploaded file.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Then were does it place it. I have not defined an area.
 
Uploaded Files will by default be stored in the server's default temporary directory unless the upload_tmp_dir is set to something else in PHP.ini.


If you can't modify the path for upload_tmp_dir for any reason, you can use the move_uploaded_file() function to move the Uploaded files to another location after they have been uploaded.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Depending on your host you may get open_basedir problems. But I don't want to confuse the issue so if you get it we can deal with it then, just want to give you the heads up that you may get a problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top