Hello I'm currently doing a web page but it won't upload a file to the server.
I click upload and it says that the files there but its not...
Below is my code. Thank you in advance.
<?php
error_reporting(E_ALL);
/**********************************************
Micro Upload
Version: 0.1
Date: 2006-10-27
Usage:
Set the uploadLocation variable to the directory
where you want to store the uploaded files.
Use the version which is relevenat to your server OS.
*************************************************/
//Windows way
$uploadLocation = "./Uploaded";
//Unix, Linux way
//$uploadLocation = "\tmp";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Upload Files - Dixon Design Services</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/></head>
<body bgcolor="#0000FF" text="#FFFFFF" link="#FFFFFF">
<table width="900" border="0" align="center">
<tr>
<th scope="row"><p align="center">Welcome to </p>
<p align="center">Dixon Design Services, LLC<br>
(231) 929 - 7005</p>
<p align="center">Experienced - Reliable - Responsive </p></th>
<th scope="row"><div align="center"><img src="/Logouse.JPG"
width="166" height="139" alt="Dixon Design Services"
longdesc="http://www.dixondesignservices.com" /></div></th>
</tr>
</table>
<p align="center"><SCRIPT src="../displayFlash.js"></SCRIPT></p>
<div id="main">
<div id="caption"><strong>UPLOAD FILE</strong></div>
<div id="icon"></div>
<form action="<?php echo $SERVER['../PHP_SELF']; ?>" method="post"
name="fileForm" id="fileForm" enctype="multipart/form-data">
<div align="center"><strong>File to upload:</strong>
</div>
<center>
<table>
<tr><td><input name="upfile" type="file" size="36"></td></tr>
<tr><td align="center"><br/><input class="text" type="submit"
name="submitBtn" value="Upload"></td></tr>
</table></center>
</form>
<?php
if (isset($POST['submitBtn'])){
?>
<div id="caption">RESULT</div>
<div id="icon2"></div>
<div id="result">
<table width="100%">
<?php
$target_path = $uploadLocation . basename( $_FILES['upfile']['name']);
if(move_uploaded_file($FILES['upfile']['tmp'], $target_path))
{
echo "The file: ". basename( $FILES['upfile']['name']).
" has been uploaded!";
}
else
{
switch($_FILES['upfile']['error'])
{
case 0:
echo "There is no error, the file uploaded with success. ";
break;
//
case 1:
echo "The uploaded file exceeds the upload_max_filesize directive
in php.ini. ";
break;
//
case 2:
echo "The uploaded file exceeds the MAX_FILE_SIZE directive that
was specified in the HTML form. ";
break;
//
case 3:
echo "The uploaded file was only partially uploaded. ";
break;
//
case 4:
echo "No file was uploaded. ";
break;
//
case 6:
echo "Missing a temporary folder. Introduced in PHP 4.3.10 and PHP
5.0.3. ";
break;
//
case 7:
echo "Failed to write file to disk. Introduced in PHP 5.1.0. ";
break;
//
case 8:
echo "File upload stopped by extension. Introduced in PHP 5.2.0.
";
break;
//
default:
echo "Unknown error";
}
}
?>
</table>
</div>
<?php
}
?>
<div>
</body>