|
Posted by rfhurley on 01/18/07 22:05
* dumb newbie alert *
Hi, it's me again. This time I'm learning to upload files. I'm using an
HTML form file:
<form method=post action="upload_file.php"
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>
which sends the file (in this case, "red.jpg") to the following PHP
file:
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_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 "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("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"];
}
}
}
else
{
echo "Invalid file";
}
?>
....and this is the message that appears:
Upload: red.jpg
Type: image/jpeg
Size: 7.0869140625 Kb
Temp file: /tmp/phpu4jlYq
Stored in: upload/red.jpg
so far; sur real...
the problem is, that I can't find my file "red.jpg", or
"upload/red.jpg"-- or even a folder marked "upload/"-- anywhere on my
server. Am I missing something? (well, <i>obviously...</i>)
and [if so] what should I do?
Thanks for your patient assistance.
Navigation:
[Reply to this message]
|