For those who don't know - I just figured out why my upload was not working. Form Tools cannot create an file upload script for you - you have to do it yourself. First I made sure my server was configured for file uploads, and I had them add a tmp folder in the php ini settings. I dont know if that did anything but I will mention it anyway.
Now- I found a script online for file uploads and I adapted it to work with my form.
MAKE YOUR FORM START WITH THIS:
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" enctype="multipart/form-data">
INSTEAD OF THIS:
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post">
Then add this below the submit button on your form:
<?php
if (isset($_POST['YOUR SUBMIT BUTTON NAME'])){
// Define the upload location
$target_path = "c:\\";
// Create the file name with path
$target_path = $target_path . basename( $_FILES['YOUR FILE FIELD NAME']['name']);
// Try to move the file from the temporay directory to the defined.
if(move_uploaded_file($_FILES['YOUR FILE FIELD NAME']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['YOUR FILE FIELD NAME']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
Replace these values with your own:
YOUR FILE FIELD NAME
YOUR SUBMIT BUTTON NAME
That should make it so you can upload files with your own php form
Now- I found a script online for file uploads and I adapted it to work with my form.
MAKE YOUR FORM START WITH THIS:
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" enctype="multipart/form-data">
INSTEAD OF THIS:
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post">
Then add this below the submit button on your form:
<?php
if (isset($_POST['YOUR SUBMIT BUTTON NAME'])){
// Define the upload location
$target_path = "c:\\";
// Create the file name with path
$target_path = $target_path . basename( $_FILES['YOUR FILE FIELD NAME']['name']);
// Try to move the file from the temporay directory to the defined.
if(move_uploaded_file($_FILES['YOUR FILE FIELD NAME']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['YOUR FILE FIELD NAME']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
Replace these values with your own:
YOUR FILE FIELD NAME
YOUR SUBMIT BUTTON NAME
That should make it so you can upload files with your own php form