Jump to content
Sign in to follow this  
etsted

displaying images

Recommended Posts

this is my image code. Is there a way for me to make sure that all of it are displayed on the browser?

 

<html>
<body>
<form action="index.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<input type="submit" name="submit" />
</form>
<?php
include "connect.php";
if(isset($_POST["submit"]))
{
$loc = "bilder/";
if(($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") ||
($_FILES["file"]["type"] == "image/jpg"))
{
$file = explode(".", $_FILES['file']['name']);
mysql_query("INSERT INTO bilder VALUES('','".$file[0]."', '".$file[1]."')") or die(mysql_error());
$id = mysql_insert_id();
$newname = $id.$file[1];
$path = "$loc$newname";
move_uploaded_file($_FILES['file']['tmp_name'], $path);
echo "du har lastet opp et bilde. klikk her <a href='$path'>klikk</a>";
} else {
echo "invalid file";
}
}
?>
</body>
</html>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...