I have this html form
<html>
<body>
<form action="accept-file.php" method="post" enctype="multipart/form-data">
Your Photo: <input type="file" name="photo" size="25" />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
and this php file
<?php
if($_FILES['photo']['name'])
{
if(!$_FILES['photo']['error'])
{
$new_file_name = strtolower($_FILES['photo']['tmp_name']); //rename file
if($_FILES['photo']['size'] > (10240000))
{
$valid_file = false;
$message = 'Your file is to large.';
}
if($valid_file)
{
move_uploaded_file($_FILES['photo']['tmp_name'], 'uploads/'.$new_file_name);
$message = 'Congratulations! Your file was accepted.';
}
}
else
{
$message = 'Ooops! Your upload triggered the following error: '.$_FILES['photo']['error'];
}
}
$_FILES['field_name']['name']
$_FILES['field_name']['size']
$_FILES['field_name']['type']
$_FILES['field_name']['tmp_name']
?>
I get my uploader working, but the accept-file.php does not diplay the image on mysite/accept-file.php. How can I get my picture to display on accept-file.php?
$_FILES['field_name']['name'] $_FILES['field_name']['size'] $_FILES['field_name']['type'] $_FILES['field_name']['tmp_name']these need ending semi-colons, but you're not echoing anything. Having usederror_reporting(E_ALL); ini_set('display_errors', 1);would have triggered a parse error.