<form action="" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<p>
<label for="file">Path name:</label>
<input type="input" name="loc" id="loc" value="sites/default/files/"/>
<p>
<input type="submit" name="submit" value="Submit" />
</form>
<?php
if (isset($_POST['loc'])){
if ( $_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"] , $_POST["loc"].$_FILES["file"]["name"]);
echo "Stored at: " . $_POST["loc"].$_FILES["file"]["name"] ;
}
}
?>
No comments:
Post a Comment
Your comment is so valuable as it would help me in my growth of knowledge.