note 74808 deleted from features.file-upload by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 17:56:28 +0000 |
| Subject: | note 74808 deleted from features.file-upload by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134334@lists.php.net to get a copy of this message | ||
Note Submitter: Chaos Mixed aka Chaosmixed
----
To people with IIS and php on a windows XP machine:
Php.ini:
upload_tmp_dir = "C:\Inetpub\wwwroot\upload_tmp\"
then create two folder in the wwwroot directory:
C:\Inetpub\wwwroot\upload
C:\Inetpub\wwwroot\upload_tmp
Make sure sharing, web sharing and ntfs security, is ok
------------------------
upload form
<html>
<body>
<form action="uploader.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:<label>
<input type="file" name="file" id="file" >
<br >
<input type="submit" name="submit" value="Submit" >
</form>
</body>
</html>
------------------------
the uploader
<?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"];
echo "<br>";
}
if (file_exists("/php/upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" .
$_FILES["file"]["name"];
}
?>