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">
			<legend>Upload File:</legend>
			<input type="file" name="upload"  />&nbsp;<input type="submit" name="submit" value="Submit" />

and here is the php code:

<?php #upload.php
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";
			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?


Member Avatar


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']))