Im working on an upload system and for some reason it doesnt work like it cant move it to the correct destination here is the website www.fallenskydesigns.com/uploads/upload.html where it is being tested
and here is the script
<html>
<head>
<title>Uploading...</title>
</head>
<body>
<h1>Uploading file...</h1>
<?php
if ($FILES['userfile']['error']>0)
{
echo 'problem: ';
switch ($FILES['userfile']['error'])
{
case 1: echo 'File exceeded upload_max_filesize'; break;
case 2: echo 'File exceeded max_file_size'; break;
case 3: echo 'File only partially uploaded'; break;
case 4: echo 'No File Uploaded'; break;
}
exit;
}
if ($_FILES['userfile']['type'] != 'image/gif')
{
echo 'Problem: file is not a proper extension';
exit;
}
$upfile = '/uploads/' .$_FILES['userfile']['name'] ;
if(is_uploaded_file($FILES['userfile']['tmp_name']))
{
if (!move_uploaded_file($FILES['userfile']['tmp_name'], $upfile))
{
echo 'Problem: Could Not Move File To Destination Directory';
exit;
}
}
else
{
echo 'Problem: Possible file upload attack. Filename: ';
echo $_FILES['userfile']['name'];
}
echo 'File uploaded sucessfully<br><br>';
$fp = fopen($upfile, 'r');
$contents = fread ($fp, filesize ($upfile));
fclose ($fp);
$contents = strip_tags($contents);
$fp = fopen ($upfile, 'w');
fwrite($fp, $contents);
fclose ($fp);
echo 'Preview of uploaded file contents:<br><hr>';
echo $contents;
echo '<br><hr>';
?>
</body>
</html>
thanks in advance.