upload image with ajax php

How to upload form data and image file using Ajax

Welcome back to shortlearner.com, today in this post we will see how to store user information and photo into MySQL database using Ajax JQuery and PHP. in our previous post we learn how to force fully download a file from the server with the help of php.

upload image with ajax php

so before start this tutorial we should take an overview of the scenario of the post.
we are designing a responsive signup form with username, email and multiple file options with the help of HTML, CSS and Bootstrap.

Advertisement


after submission of the form we will call a AJAX request with the help of JQuery, and we will send all the form information into our signup.php.

in signup.php we will creating a database connection and also validate the form data and file’s extension as well.

if file extension will pdf,JPG,JPEG and png than it will allow for further request otherwise the error will show on the user’s screen.

If user upload multiple files than we use foreach loop and check extension of each and every file and convert there into a unique name via using predefined PHP rand() function.

now after that process we will simply move all the files into our defined path and Insert all the data into database applying insert query and store all the data into our user table.

Also Read
How to Install PHP on CentOS.
How to Send Attachment on mail using PHP.

PHP Login Script With Remember me.
Unable to create a directory a wordpress error

How to integrate Razorpay Payment Gateway using PHP.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript

Tags: No tags

Comments are closed.