hi everyone.
ive done all the above, double checked my php.ini and my source code. ill paste the source code below once i explain my predicament.
i keep getting the default error message printing, "something unforeseen happened".
I dont know why this is happening and hoping that someone here my have an idea??
im using MAMP on php 5.4.4 and my OS is MAC OSX 10.7.5.
here is the code below, I have triple checked it but im gonna but it here just in case:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>View a quotation!</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/1.css" type="text/css" media="screen,projection" />
</head>
<body>
<?php
//script 11.4 - upload_file.php
/* this script displays and handles an html form. this script takes a file upload and stores it on the server */
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (move_uploaded_file ($_FILES['the_file']['tmp_file'], "../uploads/{$_FILES['the_file']['name']}"))
{
print '<p>Your file has been uploaded.</p>';
} else
{
//problem
print '<p style="color=red;">Your file could not be uploaded because: ';
//print a message based on the error
switch ($_FILES['the_file']['error'])
{
case 1:
print 'The file exceeds the upload_max_filesize setting in php.ini';
break;
case 2:
print 'The file max file size setting in the html form';
break;
case 3:
print 'The file was only partially uploaded';
break;
case 4:
print 'No file was uploaded';
break;
case 6:
print 'The temporary folder does not exist';
break;
default:
print 'Something unforeseen happened.';
break;
}
print '.</p>'; //completing the paragraph from above.
}//end of the move_uploaded_file() IF.
} //End of submission IF
//leave PHP and display the form
?>
<form action="upload_file.php" enctype="multipart/form-data" method="post">
<p>Upload a file using this form:</p>
<input type="hidden" name="MAX_FILE_SIZE" value="300000" />
<p><input type="file" name="the_file" /></p>
<p><input type="submit" name="submit" value="Upload This File"/> </p>
</form>
</body>
</html>