0

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!

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by diafol
0

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']))
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.