Hi Guys,

basicly what im trying to do is upload a file to a folder on a server. here is the html form:

<form enctype="multipart/form-data" action="upload.php" method="post">
		<fieldset>
			<legend>Upload File:</legend>
			<input type="file" name="upload"  />&nbsp;<input type="submit" name="submit" value="Submit" />
		</fieldset>
		</form>

and here is the php code:

<?php #upload.php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
if (isset($_POST['submitted'])) {
	if (isset($_FILES['upload'])) {
			if (move_uploaded_file ($_FILES['upload']['tmp_name'], "photos/{$_FILES['upload']['name']}")) {
				echo "The file has been uploaded";
			}else{
			echo "Fail!";
			}
	        }		
	} 
}
?>

so the problem is, no errors are shown and the file isnt uploaded.

Can anyone see anything as to why this is not working?

Thanks!

Member Avatar

diafol

This is your problem:

if (isset($_POST['submitted']))

You don't seem to have an id/name of 'submitted', although you do have a 'submit'. Try:

if (isset($_POST['submit']))