Jump to content

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?


<form action="index.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<input type="submit" name="submit" />
include "connect.php";
$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";
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...