Problem with Upload Code!! Help Plz
Posted: Fri Jul 04, 2003 3:31 am
i know ive posted a topic similair to this before.. but anyways
this code works fine for the server i have running on my own computer.. but when i uploaded it to my site, i get the die("wrong extention for upload") ... it really works wonderfully on my own computer, but i dont know what is wrong when i access it from my site.
i am uploading a .zip file as well, and the file does have size, so no error with that... any one help? please!? thank you
Code: Select all
<?
##############
# VARIABLES
##############
$uploaddir_trainers = $_SERVER['DOCUMENT_ROOT']."/downloads/trainers/".$_POST['alphabet']."/";
$uploaddir_editors = $_SERVER['DOCUMENT_ROOT']."/downloads/editors/".$_POST['alphabet']."/";
$uploaddir_patches = $_SERVER['DOCUMENT_ROOT']."/downloads/patches/".$_POST['alphabet']."/";
$uploaddir_tutorials = $_SERVER['DOCUMENT_ROOT']."/downloads/tutorials/";
$uploadext1="zip";
$uploadext2="ZIP";
##############
# UPLOAD CODE
##############
list($filename,$extension) = explode(".",$_FILES[file1][name]);
if($extension==$uploadext1 || $extension==$uploadext2)
{
if ($_POST['directory'] == "trainers"){
if ($_FILES[file1] != "") {
copy($_FILES[file1][tmp_name], $uploaddir_trainers .$_FILES[file1][name]) or die("Couldnt Upload File");
}
else {
die("no file selected for upload!");
}
}
else if ($_POST['directory'] == "editors"){
if ($_FILES[file1] != "") {
copy($_FILES[file1][tmp_name], $uploaddir_editors .$_FILES[file1][name]) or die("Couldnt Upload File");
}
else {
die("no file selected for upload!");
}
}
else if ($_POST['directory'] == "patches"){
if ($_FILES[file1] != "") {
copy($_FILES[file1][tmp_name], $uploaddir_patches .$_FILES[file1][name]) or die("Couldnt Upload File");
}
else {
die("no file selected for upload!");
}
}
else if ($_POST['directory'] == "tutorials"){
if ($_FILES[file1] != "") {
copy($_FILES[file1][tmp_name], $uploaddir_tutorials .$_FILES[file1][name]) or die("Couldnt Upload File");
}
else {
die("no file selected for upload!");
}
}
}
else {
die("wrong extention for upload");
}
?>
<HTML>
<center><h3>Upload was Successfull!</h3></center>
<center><h2><a href=members.php?id=release2>Step 2</a></h2></center>
</HTML>i am uploading a .zip file as well, and the file does have size, so no error with that... any one help? please!? thank you