|  | 
| 1 | 1 | # Dynamic PHP+MySQL+jQuery multi-upload form | 
| 2 | 2 | 
 | 
| 3 |  | -The script is a sample dynamic form; basically, you get a form containing 4 fields: First | Last | Email | Browse  and you have the option to add or remove rows from the form. | 
|  | 3 | +The script is a sample dynamic form; basically, you get a form containing 4 fields and you have the option to add or remove rows from the form. | 
| 4 | 4 | 
 | 
| 5 |  | -The script will save the First | Last | Email fields data in the database (see attached sample - accounts.sql) and will also save the path for the uploaded file ( e.g. uploads/filename.jpg ) and in the same will upload your file to the server in the upload directory ( e.g. uploads ) | 
|  | 5 | +The general structure will look like: | 
|  | 6 | + | 
|  | 7 | +## User Information | 
|  | 8 | + | 
|  | 9 | +| # | First Name | Last Name | Email | File Upload | Remove | | 
|  | 10 | +|---|------------|-----------|---------------|-------------|--------| | 
|  | 11 | +| 1 | John | Doe | john@example.com | [Choose File] | [Remove] | | 
|  | 12 | +| 2 | Jane | Smith | jane@example.com | [Choose File] | [Remove] | | 
|  | 13 | +| 3 | Bob | Johnson | bob@example.com | [Choose File] | [Remove] | | 
|  | 14 | + | 
|  | 15 | +<button id="add-row-btn" class="btn btn-primary">Add Row</button> | 
|  | 16 | + | 
|  | 17 | + | 
|  | 18 | +## How it works  | 
|  | 19 | +The script will save the First | Last | Email fields data in the database (see attached sample - `accounts.sql`) and will also save the path for the uploaded file ( e.g. `uploads/filename.jpg` ) and in the same will upload your file to the server in the upload directory ( e.g. `/uploads` ) | 
| 6 | 20 | 
 | 
| 7 | 21 | # Requirements | 
| 8 | 22 | - Apache2 or better | 
| 9 | 23 | - MySQL - 5.5.x or better | 
| 10 |  | -- PHP 5.5 or better | 
|  | 24 | +- PHP 7.x or better | 
| 11 | 25 | - an upload directory with "chmod 755" for the files to upload. | 
| 12 | 26 | 
 | 
| 13 | 27 | It shouldn't be a problem running on older versions of Apache/PHP/MySQL but I didn't tested it. | 
| 14 | 28 | 
 | 
| 15 | 29 | # Usage | 
| 16 |  | -- save the script on a webserver in a folder of your choice (e.g. /var/www/my_project/) | 
| 17 |  | -- create in the same folder a new folder and name it "uploads". If you chose a different name, make sure to change the name in the script too.  | 
| 18 |  | -- change the rights on the "uploads" folder to 755 (chmod -R 755 /var/www/my_project/uploads or chmod u+rwX,go+r -R /var/www/my_project/uploads) | 
| 19 |  | -- create a database and inside the database import the attached accounts.sql file. | 
| 20 |  | -- modify the script to reflect the details of your DB (so it can connect and save data to it) | 
| 21 |  | -- open the script via a web browser ( e.g. http://your_server_address/my_project/script_name.php ) and test it. | 
|  | 30 | +- save the script on a webserver in a directory for your project (e.g. `/var/www/my_project/`) | 
|  | 31 | +- create in the project directory a new directory and name it "uploads" (e.g. `/var/www/my_project/uploads`). If you chose a different name, make sure to change the name in the script too.  | 
|  | 32 | +- change the permissions on the "uploads" folder to 755 (`sudo chmod -R 755 /var/www/my_project/uploads` or `sudo chmod u+rwX,go+r -R /var/www/my_project/uploads`) | 
|  | 33 | +- create a database and inside the database import the attached accounts.sql file: | 
|  | 34 | + 1. Open a terminal or command prompt on your computer. | 
|  | 35 | + 2. Log in to MySQL using the mysql command-line tool, using the username and password for your MySQL server: `mysql -u username -p` (Replace the username with your MySQL username, and you will be prompted to enter your MySQL password) | 
|  | 36 | + 3. Create a new database (if it doesn't already exist) by running the following command: `CREATE DATABASE database_name;` (Replace database_name with the name of the database you want to create) | 
|  | 37 | + 4. Switch to the new database by running the following command: `USE database_name;` | 
|  | 38 | + 5. Import the SQL file into the database by running the following command: `SOURCE /path/to/accounts.sql;` (Replace `/path/to/accounts.sql` with the actuall path to the `accounts.sql` file on your machine ) | 
|  | 39 | +- modify the script to use the credentials for your DB | 
|  | 40 | +- open the script via a web browser ( e.g. http://localhost/my_project/script_name.php ) and test it. | 
| 22 | 41 | 
 | 
| 23 | 42 | 
 | 
| 24 | 43 | # To do | 
|  | 
0 commit comments