Hi,
I am putting an upload function in my project. I need to upload only images that is, .jpeg, .gif.
But I am not being able to do this, all types of files are being uploaded. Below is my code:
include("db_connect.php");
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$HTTP_POST_FILES['ufile']['name'];
if($ufile !="none")
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "<table width=300 height=300 align=center>
<tr><td align=center><B>
Your symbol has been successfully uploaded.<?B>
</td></tr>";
echo "<tr><td align=center>";
echo "<tr><td align=center>";
echo "<img src=\"$path\" width=\"150\" height=\"150\">";
echo "</td></tr>";
echo"<tr><td align=center>";
echo "Image name:.$key";
echo "</td></tr>";
echo "<tr><td align=center>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>";
As you can see in this code the images are saved in a folder but i want to send them in a database. I am not being able to use the POST method to send it to database. Can anyone please help????