This is my php code
<?php
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
{
mkdir("upload/".$title, 0700);
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/".$title . $_FILES["file"]["name"]);
echo "Stored in: " ."upload/".$title . $_FILES["file"]["name"];
}
}
?>
Simple file upload according to W3C, however i added the mkdir to create a directory based on the title the user input.
The folder creates fine but the file won't move into it, not sure if this is something simple i thought but use the concatenate '.' i could just define the file location like i had with mkdir
The HTML is simple just input type = file and and input text type for the title
$titleis defined you're parsing it to remove characters you're not allowed in a folder name?