Howdie Folks,
I have created a page - PagePost.php on my site. This page should be able to take a filename/path via a browse function, the name the user wants the page to be named, and the subdirectory the user wants the uploaded page to be placed in. I have written a line of code below: print "$filename, $pagename, $list"; to print out my variables to see what is actually getting posted. The destination file name and directory are making it to the site, but the file is not.
Any suggestions would be greatly appreciated.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
require('header.html');
//Begin conditional
//If the submit button is chosen
if (isset($POST['submit']))
{
$pagename = $POST['pagename'];
$list = $POST['list'];
$filename = $POST['filename'];
print "$filename, $pagename, $list";
$targetPath = $list ."/".basename($_FILES['filename']['tmp_name.txt']);
if(move_uploaded_file($_FILES['filename']['tmp_name.txt'], $target_path))
{
echo "The file ".basename( $_FILES['filename']['name'])." has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}
}
?>
<p>Enter information for desired web page upload</p>
<form enctype="multipart/form-data" action = "pagepost.php" method="post">
<p>File to Upload: <input name="filename" type="file" size="100"><br /></p>
<p>Page Name: <input type="text" name="pagename" size="20" /><br /></p>
<p>Directory: <select name="list" style="width:100">
<option value=""></option>
<option value="/">MySite.net</option>
<option value="Training">Training</option>
</select><br /></p>
<input type='submit' name='submit' value="Register" />
</form>
<?php
require('footer.html');
?>