how do i insert a image into a directory through MySQL, rename it, generate a link and upload the generated link in MySQL......???

anyhelp will be really apprietiated....

and if its a tutorial its the best way out, i'm not good at PHP.....

plz its urgent for me..

thx alot..

try the move_uploaded_file() function to save the file into your directory and create a variable that will create a path to your file in the directory that will be used to store the path in mysql.
it goes something like this..
<?
move_uploaded_file($_FILES,$newimage);
$ewan="../photoupload/";
$ewanko=$ewan . $newimage;
$query="insert into test1 set title='" .$_POST. "',path='$ewanko',memid='$memid'";
mysql_query($query);
}
?>

how do i insert a image into a directory through MySQL, rename it, generate a link and upload the generated link in MySQL......???

anyhelp will be really apprietiated....

and if its a tutorial its the best way out, i'm not good at PHP.....

plz its urgent for me..

thx alot..

I found a great tutorial to do this here: http://www.php-mysql-tutorial.com/upload-to-file-server.php

I figured out a lot from this site!

definitely base on your title you cant use mysql to move your file in the directory. but in php its posible, like ryan was posted..
and the use of mysql there is to save other information in the database
like Description, ImageName, Id, ForeignID etc..

how to insert image into mysql database in php .............
pls give error free code..............,,,,,,,,,,,,,,,,,

Edited 6 Years Ago by rahulsabari: n/a

This article has been dead for over six months. Start a new discussion instead.