954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Image Upolad in a folder and saving path in MySql

Hello.. Everyone.. I am very new to PHP world.. I have got a lesson to Saving images in folder and paths to database.. I have tried a lot.. I have tried various websites but there has no complete solution! Will you provide me the proper code?

edn_781
Newbie Poster
10 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

I know this is an old issue but I am stuck in it!

edn_781
Newbie Poster
10 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

check out he php manual for file uploads. Nice and simple.
Assume DB connection details already given

$dest = "images/" . basename( $_FILES['uploadimg']['name']); 
if(move_uploaded_file($_FILES['uploadimg']['tmp_name'], $dest)){
   $r=mysql_query("INSERT INTO table SET fname='$dest'"); 
   //you could add more info to the query eg from $_POST variables from the upload form
   //do any mysql error handling here
}else{
   echo "Error with upload";
}
diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Thanks a lot! I am trying now!

edn_781
Newbie Poster
10 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: