-2

i got this error while i working in image share service and while i try upload image nothing happens and no image gets upload and please can you add on the code the code which make every image uploaded stored in a folder ? my service code :

<html>
<head>
     <title>upload images</title>
</head>
<body>

<form action="upload.php" method="POST" enctype="multipart/form-data">
   image:
   <input type="file" name="image"> <input type="submit" value="Upload">
</form>

<?php 
// connect to database
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("meinimages") or die(mysql_error());

// file properties
$file = $_FILES['image']['tmp_name'];

if (!isset($file))
    echo "please choose an image.";
else
{
 $image = addslashes(file_get_contents($_FILES['image']['tmp_name']));  
 $image_name = addslashes($_FILES['image']['name']);
 $image_size = getimagesize($image);

 if ($image_size==FALSE)
     echo "you try upload no/..image.";
else
 {
    if (!$insert = mysql_query("INSERT INTO store VALUES ('','$image_name','$image')"))
      echo "problem while upload $image.";
    else
    {
      $lastid = mysql_insert_id();
      echo "image is uploaded.<p />your image:<p /><img src=get.php?id=$lastid>";
    }



 }

}
jack
  • 1
  • 7

1 Answers1

0

Just use this code ~

<input type="file" name="uploadsrc" />

<?php
move_uploaded_file("uploads/".$_FILES["uploadsrc"]["name"]);
?>

No need to shout out your question as everybody can see it!

Keval
  • 141
  • 1
  • 10