I have been working with an upload script that works if you do not post any variables with it, but i NEED to post some variables along with the upload script. here is the code....
<form action="doupload.php" method="POST" ENCRYPT="multipart/form-data">
<input type="hidden" name="selectfolder" value="<? echo $selectfolder; ?>">
<input type="hidden" name="tothisfolder" value="<? echo $tothisfolder; ?>">
File : <input type="file" name="fileupload"><br>
<br>
Select the folder to upload to : <select name="theendfolder">
<?
$sql=mysql_query("SELECT DISTINCT * FROM categories WHERE userinput = '1' AND folders = '$tothisfolder'");
while($newinput=mysql_fetch_object($sql)){
$typeisa = $newinput->other;
echo '<option value="'. $typeisa .'">'. $typeisa .'</option>';
}
?>
</select>
<br><br>
<input type="submit" value="Go">
</form>
$selectfolder is a number...either 1 or 0. 1 is user input folder, and 0 is automatically put the file in a folder corresponding with the first letter of the file name.
here is the doupload.php code :
<?
include('../_dbconnect.php');
$selectfolder=$_POST['selectfolder'];
$tothisfolder=$_POST['tothisfolder'];
$theendfolder=$_POST['theendfolder'];
$filename = strtolower($_FILES['fileupload']['name']);
echo $selectfolder.'<br><br>';
echo $filename."<br><br>";
if($selectfolder==0 OR $selectfolder=""){
$str = $filename;
$char=$str{0};
$char=strtoupper($char);
$folder="../".$tothisfolder."/".$char.'/';
}
if($selectfolder==1){
$folder='../'.$tothisfolder.'/'.$theendfolder.'/';
}
echo $folder.$filename;
//if(move_uploaded_file($_FILES['userfile']['tmp_name'], $folder.$filename)){ // Upload file
// print "Success! <Br><br>The file $filename has been uploaded";
//}else{
// print "Error! File size might exceed upload limit of server. Try again."; // Display error
//}
echo '<br><Br><a href="upload.php">Go Back</a>',"\n";
?>
all the variables except $selectfolder are returning as "" 🙁 Anything i am missing here?
Thanks in advance!
Tim