I know this one gets asked a lot but after reading about 5 topics about this I still can't figure out what i have to do.

Can anyone help me change this script so it will upload images, then tell if there is a specific way to display them or is it just in an img tage like this? <img src="$image">

<?
$username="user";
$password="pass";
$database="db";

$tut_name=$_POST['tut_name'];
$tut_link=$_POST['tut_link'];
$tut_program=$_POST['tut_program'];
$tut_category=$_POST['tut_category'];
$tut_video=$_POST['tut_video'];
$tut_download=$_POST['tut_download'];
$tut_image=$_POST['tut_image'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO tutorials VALUES ('','$tut_name','$tut_link','$tut_program','$tut_category','$tut_video','$tut_download','$tut_image')";
mysql_query($query);

mysql_close();
?>

also do i need to change anything in my upload form, and should I use blob or longtext (i think thats it?) because ive seen some people use blob and some use the other whats the difference or are they the same? i'm currently using blob.

If anyone can help thanks.

Hi ...

your form should look like this:
<form action="..." method="POST" enctype="multipart/formdata">

after that you have to have a file tag in your form <input type="file" name="txtImage">

in your php script you can use $image = $_FILE["txtImage"]["name"], but you should do some checkings before processing the image...

good luck

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.