<form action="index.php" method="post" enctype="multipart/form-data">
File: <input type="file" name="image"><input type="submit" value="Upload">
</form>
<?php
//connect to db
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db ("databaseimage")or die (mysql_error());
@$file =$_FILES['image']['tmp_name'];//kjo eshte e lidhur me <input type="file" name="image">
if (!isset($file))
echo ("Please select an image");
else {
$image= addslashes(file_get_contents ($_FILES['image'] ['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize ($_FILES['image'] ['tmp_name']);
if(@$image_size==FALSE)
echo "Nuk eshte imazh ky or bir hahahahah";
else
{
if(!$insert =mysql_query ("INSERT INTO store VALUES ('','$image_name','$image')"))
echo ('Pati problem ne ngarkim');
else {
$lastid = mysql_insert_id ();
echo "Image uploaded.<p />Your image:<p /><img src=get.php?id=$lastid>";
}
}
}
?>
andyy121 -9 Junior Poster
andyy121 -9 Junior Poster
jkon 638 Posting Whiz in Training Featured Poster
diafol
andyy121 -9 Junior Poster
diafol
andyy121 -9 Junior Poster
andyy121 -9 Junior Poster
andyy121 -9 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.