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?

Recommended Answers

All 3 Replies

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

Member Avatar for diafol

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";
}

Thanks a lot! I am trying now!

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.