How do i upload image file in a dir using php? Below is my form page code

Kindly somebody help i have tried uploading image with blob type data input on my database but after i search over the internet i found out that it is not a good idea and now i want to upload it to my directory how do i do here? Down below my code somebody kindly help me.



	die("Database connection error");

// insert query for register page

	 $query="INSERT INTO `proposals` (`details`,`location`,`date`,`time`,`checkbox`,`name`,`agegender`,`contact`,`empid`,`dept`  ,`organization`,`summary`,`images`,`outcome`,`cause`,`action`,`reportedname`,`position`,`organisation`,`reportedcontact`,`reporteddept`,`status`,`comment`) VALUES ('$details','$location','$date','$time','$checkbox','$name','$agegender','$contact','$empid','$dept' ,'$organization','$summary','$images','$outcome','$cause','$action','$reportedname','$position','$organisation','$reportedcontact','$reporteddept','$status','$comment')";
		$_SESSION['success']="Not Inserted successfully!";
		echo "<script>alert('Proposal not applied!');</script>";

Have a read up on move_uploaded_file() - that can move the file you upload into your storage folder, then you store the path in your database.

You should take care with security - at least use htmlspecialchars to prevent users from entering malicious code …

Despite this, move_uploaded_file is the solution, then save the filename in your database.
You can also find good jQuery uploader plugins to enhance UI & improve security (MIME type check, …)
This file uploader is far the best I know

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.