how to place the path of an uploaded image in a database on an html file input

// Get the name of images
  	$Get_image_name = $_FILES['image']['name'];
  	
  	// image Path
  	$image_Path = "images/".basename($Get_image_name);

  	$sql = "INSERT INTO student_table (imagename, contact) VALUES ('$Get_image_name', 'USA')";
  	
	// Run SQL query
  	mysqli_query($conn, $sql);

  	if (move_uploaded_file($_FILES['image']['tmp_name'], $image_Path)) {
  		echo "Your Image uploaded successfully";
  	}else{
  		echo  "Not Insert Image";
  	}
  }

3
2

                                    <?php
include("config.php");

if(isset($_POST['but_upload'])){
 
  $name = $_FILES['file']['name'];
  $target_dir = "upload/";
  $target_file = $target_dir . basename($_FILES["file"]["name"]);

  // Select file type
  $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));

  // Valid file extensions
  $extensions_arr = array("jpg","jpeg","png","gif");

  // Check extension
  if( in_array($imageFileType,$extensions_arr) ){
 
    // Convert to base64 
    $image_base64 = base64_encode(file_get_contents($_FILES['file']['tmp_name']) );
    $image = 'data:image/'.$imageFileType.';base64,'.$image_base64;
    // Insert record
    $query = "insert into images(image) values('".$image."')";
    mysqli_query($con,$query);
  
    // Upload file
    move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);
  }
 
}
?>

<form method="post" action="" enctype='multipart/form-data'>
  <input type='file' name='file' />
  <input type='submit' value='Save name' name='but_upload'>
</form>

3 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to upload image in php mysql database php how to upload image to folder and insert record to database how to upload an image into local storage in php how to upload images using php upload and save image in php upload image to a folder php php image upload how to upload and retrieve image from database in php form save uploaded image in folder php upload image in database using php upload and display image using php mysql upload and display image in php mysql image upload and display in php and mysql how we can upload image in databse using php mysql PHP uploading image to databse how to upload image in sql database using php image upload and retrieve in php source code save image from url to folder php php form upload image and text to database how to upload an image to database php mysql how to upload image in mysql database using php store image file from database to local file in php how to upload photo in php php how to upload images to server php upload picture and display how to upload image to dattabase using mysql and php how to upload image by php how to upload picture in php mysql image uploader php How to Upload Image in PHP with Demo in MySQL Database Upload and Store Image File in Database using PHP and MySQL image upload in folder in php php mysql to upload image to db upload image with php to mysql upload image to php database save image in folder in php image upload in php local upload picture php save image php from upload how to upload image to database php without a form how to save image to database in php using image_upload(); how to upload an image in php mysql save image in php folder how to store image in database using php upload image to server with php folder create when image upload in php how to upload picture on database and view it using php how to upload a picture on my sql database using php PHP/MYSQL- How to upload Image in Folder and Save Path in Database code PHP/MYSQL- How to upload Image in Folder and Save Path in Database exemplo upload image setting in php how to upload image file in php upload image to a folder using php php + how upload pictures location image folder to upload to server in php how to upload image into database and display it using php how to upload image with php upload image in php mysql database how to upload image in php database image upload in folder using php what is the use /upload*/ in php image upload upload and display image in php upload image server php php upload image to local folder .php into image upload php into image upload image upload database php mysql php upload and show image php image file upload upload php file in image upload upload images php php image upload to folder how to upload image php how to upload image and show in php how to upload image from database in php php upload and insert images to database php upload and insert images to folder php image upload and display php simple upload image upload image with php upload image php from photo upload in php mysql php upload image upload image mysql php how to upload image using FILES php how to upload image name to database using php php load image and store it in project folder how to store uploaded image in folder using php upload image to mysql php php source code to upload image insert query for image upload in php upload image in php to sql db php upload images to db store image in folder using php how to upload image only one time in database in php and folder how to upload file in php to folder and database php upload image in database php image uploader php upload image to folder and database how to upload files in php and store in database php code to upload image in mysql upload image database php how to upload image in php from and write how to upload/insert image into database using php mysql how to upload image to database php forms how to upload image to database php upload a file or an image to the database using php and also to store that file at a particular location for future use php mysql image upload and display how to upload image and save in php open an image file for upload in php php upload images to folder how to upload img in php php upload image code mysql insert image to database php from own directory insert image to database php from directoru have to image uploaders php image upload program in php how to upload and display image in php upload picture with php upload pictures with php how to upload image in php and store in folder how to upload image in php and store in database and view in php upload imae php code to upload images php how to upload image in php mysql php image upload page upload image using php mysql upload image file in php upload picture through php php image upload and store php image upload and save to database image upload in php php code to upload image to database user upload image and save to database using php upload photo in php upload image to server php php image upload upload image to sql databse using php Write a PHP program for the uploading the images in a directory. image upload in php with database how to upload image file using php into html upload image and display using php how to upload image and save in folder in php upload image in php with url php image upload in server folder php image upload in server php upload image to database and display how to upload image in database using database using php image upload database php upload a picture to a folder php php image upload code image upload code php php form image upload store in mysql database Write a program to upload a image file on a server. in php upload images in php database upload image to sql server using php mvc upload image to database php picture upload in php image file upload in php php code to upload image php upload picture upload image add to sql database in php upload image using php upload image to sql database php upload image php mysql php upload image mysql php image upload upload image file php php image upload script php save image to folder php upload images php upload ans save image php code upload image to mysql database upload com php php file uploads Php code for image upload and display how to store uploaded image in database in php php image upload example php simple upload image file php upload image example image upload using php how to upload the image in php upload a image php how to upload image using php PHP UPLOADE IMAGE image upload on php php upload image to server upload pictures php using image upload with php upload images in php how to save image in folder and path to database using php php upload and save image php form save image in database and folder php upload an image how to save image in folder using php upload image to a folder in php php upload image to database how to upload image to database in php how to upload picture on database using php source code Image upload in PHP code with databases upload image to database using php How to upload image in folder using PHP upload image into server php upload a image in php php upload image php upload file/image upload img in to data base in php image upload in php image upload php how to upload image to mysql in php image upload in php mysql how to upload image in database using php how to upload image php mysql php image upload in database how to upload image in php upload image to php server how to upload images to database using php how to upload image in a folder using php save image upload php how to upload a image in php how to upload images in php image upload php mysql upload file in database using php upload image in folder using php using php how upload an image on server how to upload image into mysql database using php how to upload image in folder and save path in database using php upload image php upload image in database in php upload image in php php upload and save image to mysql how to fecth databse uidn file directory how to upload image in mysql using php how to insert and display image in database using php uploading images to database php get uploaded photo in db sql query of image to upload image php upload photo to database how to upload image in php and store in database upload image to database php how to upload picture to mysql with php difference between uploading image to database and to file php how to insert photo phpmyadmin using php how to store the image in database using php user upload images and save to database upload image to mysql how to submit image to database How to Upload Image in database using PHP MySQLi upload an image using php to database using folder location upload an image to database using file location in php insert images from folder into database without user php insert image into database from folder insert image into database using image file from folder php to insert image into database using image file from folder without post php to insert image into database using image file from folder with outpost how to upload photo in php with mysql how to add photo to database when the user uplode it how to upload photo using php and mysql upload image to database without query php php upload image and save to folder a PHP program to insert image into the database. how to input image in html form and saved into db image uploading in php and mysql host image data in database php image upload database make server to store and send images php image get in query using form submit insert img into server from js pèhp image upload sql php change image extension on image upload and save to database fix number of images Uploading Only users into DB php how to insert data and image from database into a frame in php php upload image to folder php user registration form with mysql image upload how to place the path of an uploaded image in a database on an html file input store and retrieve image from database in php how to save pictures in database and show in html php automaticaly add image for table from directory php add image fopr table from server how to upload image in phpmyadmin how to upload photo to database and show image after upload picture php mysql how to upload image in a table how to upload image from database in one php file and display in the other how to upload image from database how to insert image in php mysql display the file from the database uploading images to online database how to upload image to mysql database and display it using php how to fetch image from database and folder in php how to send images in database website with database and upload images collect image from a database and display it a input in php Write a php code to upload an image in server directory also retrieve uploaded image on web page. upload images to sql database php how to upload and save image in database using php upload image and store in system php how to upload images in database for upload image what data type need in database in pphp how to upload an image from your computer to ypur database code HOW TO UPLOAD IMAGE TO A DATABASE USING PHP how to add images in database and fetch them upload a folder in database upload image in php mysql database and display demo php image upload and save in db image upload code in php with database image url entry image store into server folder example how to upload image from form to phpmyadmin using php save image in database php insert upload image in folder php mysql can i upload a directory of images to mysql insert image through php database and display in required position upload image in php mysql database and display php image upload to db php image upload to db upload image into database using php how to upload image in php and store in database and folder
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source