I am trying to upload a file to a sever using PHP. I cannot get it to work. Here is the code:
if( isset($_POST['Upload']) )
{
//size condition
if ( $_FILES['uploaded']['size'] > 350000)
{
$mesg = "Your file is too large.<br>";
exit;
}
if( move_uploaded_file($_FILES['uploaded']['tmp_name'], "upload/" . $_FILES['uploaded']['name'] ) )
{
$mesg = "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else
{
$mesg = "Sorry, there was a problem uploading your file.";
}
}
else
{
$mesg = "Select a File to upload.";
}
Here is the code for the form I am using to submit the file:
<?
echo $mesg;
?>
<br /><br />
<form enctype="multipart/form-data" action="" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>