I dont understand whats wrong with this its driving me nuts!
<?
//Confirmation of images
function str_makerand ($minlength, $maxlength, $useupper, $usespecial, $usenumbers)
{
$randName = str_makerand(10,10,false,false,false);
function uploadProg($filename1,$randName,$filename2,$randName,$filename3,$randName,$filename4,$randName,$filename5,$randName){
$charset = "abcdefghijklmnopqrstuvwxyz";
if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($usenumbers) $charset .= "0123456789";
if ($usespecial) $charset .= "~@#$%^*()_+-={}|]["; // Note: using all special characters this reads: "~!@#$%^&*()_+`-={}|\\]?[\":;'><,./";
if ($minlength > $maxlength) $length = mt_rand ($maxlength, $minlength);
else $length = mt_rand ($minlength, $maxlength);
for ($i=0; $i<$length; $i++) $key .= $charset[(mt_rand(0,(strlen($charset)-1)))];
return $key;
}
########Set the destination here##############
$destination="/home/cspot/public_html/member_rides/";
copy($filename1,$destination."/".$filename1_name);
copy($filename2,$destination."/".$filename2_name);
copy($filename3,$destination."/".$filename3_name);
copy($filename4,$destination."/".$filename4_name);
copy($filename5,$destination."/".$filename5_name);
//change this variable $dest2 to the path you are saving items to
$dest2 = "http://www.civicspot.com/member_rides";
echo "<h1>File(s) Uploaded...</h1>";
if ($filename1_name == "") {
echo "No file was uploaded for upload 1<br>";
}
else
{
echo "<br><b><a href='$dest2$filename1_name'>$filename1_name</a> was uploaded succesfully.</b><br>";
echo "Thise file was stored at: $dest2$filename1_name<br><br>";
}
if ($filename2_name == "") {
echo "No file was uploaded for upload 2<br>";
}
else
{
echo "<br><b><a href='$dest2$filename2_name'>$filename2_name</a> was uploaded succesfully.</b><br>";
echo "Thise file was stored at: $dest2$filename2_name<br><br>";
}
if ($filename3_name == "") {
echo "No file was uploaded for upload 3<br>";
}
else
{
echo "<br><b><a href='$dest2$filename3_name'>$filename3_name</a> was uploaded succesfully.</b><br>";
echo "Thise file was stored at: $dest2$filename3_name<br><br>";
}
if ($filename4_name == "") {
echo "No file was uploaded for upload 4<br>";
}
else
{
echo "<br><b><a href='$dest2$filename4_name'>$filename4_name</a> was uploaded succesfully.</b><br>";
echo "Thise file was stored at: $dest2$filename4_name<br><br>";
}
if ($filename5_name == "") {
echo "No file was uploaded for upload 5<br>";
}
else
{
echo "<br><b><a href='$dest2$filename5_name'>$filename5_name</a> was uploaded succesfully.</b><br>";
echo "Thise file was stored at: $dest2$filename5_name<br><br>";
}
echo "<br><br><a href=\"upload.php\">Click here to go back.</a>";
}
function main(){?>
<form method="post" action="<? echo $PHP_SELF; ?>" enctype="multipart/form-data">
<p>Files to Upload:<br>
<input type="file" name="filename1" size="20" tabindex="1">
<br>
<input type="file" name="filename2" size="20" tabindex="2">
<br>
<input type="file" name="filename3" size="20" tabindex="3">
<br>
<input type="file" name="filename4" size="20" tabindex="4">
<br>
<input type="file" name="filename5" size="20" tabindex="5">
<br>
<input type="hidden" name="action" value="uploadProg">
<input type="submit" value="Upload Files" tabindex="6">
</p>
<p><a href="<?echo $dest2; ?>">Click here to view the folder of current items</a></p>
</form><?}
switch ($action){
default:
main();
break;
case "uploadProg":
if ($filename1=="none") {echo("<h1>No File Selected....</h1>"); break;}
uploadProg($filename1,$randName,$filename2,$randName,$filename3,$randName,$filename4,$randName,$filename5,$randName);
break;
}
?>