php - Why isn't my image displaying on this webpage? -


in program after user clicks upload, why doesn't image appear on page?

even after click upload still says "not working lol". not sure i've gone wrong.

upload.php:

<html><head><title>php form upload</title></head><body>  <form method='post' action='upload.php' enctype='multipart'/form-data'> select file: <input type='file' name='filename' size'500' /> <input type='submit' value='upload' /> </form>  <?php if($_files) {     $name = $_files['filename']['name'];     move_uploaded_file($_files['filename']['tmp_name'], $name);     echo "uploaded image '$name'<br /><img src='$name' />"; } else echo "not working lol"; ?> </body></html> 

get html right.

+ enctype='multipart'/form-data' - enctype='multipart/form-data' 

this easier spot if did not echo html, this.

<html>     <head>         <title>php form upload</title>     </head>     <body>     <form method='post' action='upload.php' enctype='multipart/form-data'>         select file: <input type='file' name='filename' size'500' />         <input type='submit' value='upload' />     </form>  <?php     if ($_files):     $name = $_files['filename']['name'];     move_uploaded_file($_files['filename']['tmp_name'], $name); ?>     uploaded image <?= $name;?><br /><img src="<?= $name;?>"/> <?php else: ?> not working lol <?php endif;?>     </body> </html> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -