I having a problem getting image and store them in database
The problem is it's showing that pimage is Undefined and the image I choose is not storing in the database
This is the Image when I try to submit it to show you what the problem is
This is my database look like
It's not storing my image
$fol = $_POST['folder'];
$lin = $_POST['link'];
$target_dir="image/";
$target_file=$target_dir.basename($_FILES['pimage']['name']);
move_uploaded_file($_FILES['pimage']['tmp_name'],$target_file);
if(empty($fol)){
echo "<div class='alert-danger'><i class='fa fa-exclamation-circle'>
<strong>Please Enter Folder Name</strong>
</i></div>";
}
if(empty($lin)) {
echo "<div class='alert-danger'><i class='fa fa-exclamation-circle'>
<strong>Please Enter Link</strong>
</i></div>";
}
else{
$sql="SELECT id FROM filelink WHERE folder_name ='$fol' LIMIT 1";
$check_query =mysqli_query($conn,$sql);
$count_folder = mysqli_num_rows($check_query);
if($count_folder>0){
echo "<div class='alert-danger'><i class='fa fa-exclamation-circle'>
<strong>Sorry Folder Name Already Exist</strong>
</i></div>";
}
else{
$sql ="INSERT INTO filelink(link,folder_name,folder_image)VALUES('$lin','$fol','$target_file')";
$run_query=mysqli_query($conn,$sql);
if($run_query){
echo "<div class='alert-success'>
<strong>Add File Successful Refresh Page to see Change</strong></i>
</div>";
}
}
}
<div class="form-popup" id="myForm">
<form action="/action_page.php" enctype="multipart/form-data" class="form-container">
<div id="e_msg" style="font-size: 13; text-align: center; margin-bottom: 10px; margin-top: 15px;">
<!-- message for adding file if success-->
</div>
<label for="folder"><b>Folder</b></label>
<input type="text" placeholder="Enter Folder Name" name="folder" required>
<label for="link"><b>Link</b></label>
<input type="text" placeholder="Enter Link" name="link" required>
<div class="custom-file">
<input type="file" name="pimage" class="custom-file-input" id="customFile" required>
<label for ="customFile" class="custom-file-label">Choose Product Image</label>
</div>
<button style="margin-top: 15px;" type="submit" class="btn btnsub">Submit</button>
Close
</form>
</div>
Related
I'm trying to insert data into database through a form. I'm uploading 2 image files, in database path of the files will be stored. I'm trying to do server side validation. when user does not upload a file or when user is uploading wrong file type, an error messages should display and page should return to same page with no data inserted into database.
This is my view:
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Add News & Event</h4>
<p class="card-description"> </p>
<?php echo validation_errors("<div class='alert alert-danger'>","</div>");?>
<?php if($failed = $this->session->flashdata('addNewsFailed')){
echo '<div class="alert alert-danger">' ;
echo $failed;
echo '</div>';
}?>
<form class="forms-sample" action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputName1">Title</label>
<input type="text" class="form-control" id="exampleInputName1" value="<?php echo
set_value("title");?>" name="title">
</div>
<div class="form-group">
<label for="exampleInputName1">Sub Title</label>
<input type="text" class="form-control" id="exampleInputName1" value="<?php echo set_value("sub");?>" name="sub_title">
</div>
<div class="form-group">
<label for="exampleInputName1">Event Date</label>
<input type="text" class="form-control" id="exampleInputName1" name="date" value="<?php echo date('d - M - y ');//echo set_value("date");?>">
</div>
<div class="container">
<div class="row">
<div class="col-md">
<div class="form-group">
<label>Feature Image</label>
<div class="input-group col-xs-12">
<input type="file" class="form-control file-upload-info" placeholder="Upload Image" name="img" style="z-index: 9999; opacity: 0;" id="image">
<div id="imageName"></div>
<span class="input-group-append">
<button class="file-upload-browse btn btn-info" type="button" style="position: absolute; left: 0; padding: 6px 23px;border-radius:3px;">Upload</button> </span>
</div>
<?php if(isset($upload_error)){
echo $upload_error;
}?>
</div>
</div>
<div class="col-md">
<div class="form-group">
<label> Banner Image</label>
<div class="input-group col-xs-12">
<input type="file" class="form-control file-upload-info" placeholder="Upload Image" name="banner" id="banner" style="opacity: 0; z-index: 9999;">
<div id="bannerName"></div>
<span class="input-group-append">
<button class="file-upload-browse btn btn-info" type="button" style="position: absolute;left: 0;padding: 6px 23px;border-radius: 3px;">Upload</button></span>
</div>
<?php if(isset($upload_error1)){
echo $upload_error1;
}?>
</div>
</div>
</div>
</div>
<span class="input-group-append">-->
<div class="form-group">
<label for="exampleTextarea1">Text</label>
<textarea class="form-control" id="exampleTextarea1" rows="2" name="para" value=""><?php echo set_value("para");?></textarea>
</div>
<button type="submit" class="btn btn-success mr-2">Add</button>
<button class="btn btn-light">Cancel</button>
</form>
</div>
</div>
</div>
</div>
</div>
This is my controller:
public function addEvent()
{
//load library
$this->load->library('form_validation');
$this->load->helper('form');
//set rules for validation
$this->form_validation->set_rules("title", "Title", "required");
$this->form_validation->set_rules("date", "Event Date", "required");
$this->form_validation->set_rules("para", "Text", "required");
//template
$this->output->set_template('admin_layout');
//image upload
$config = [
'upload_path' => './uploads/',
'allowed_types' => 'gif|jpg|png',
];
$this->load->library('upload', $config);
//validation
if ($this->form_validation->run()) {
$post = $this->input->post();
if (!$this->upload->do_upload('img')) {
$upload_error = $this->upload->display_errors();
$this->load->view('dashboard/pages/forms/addEvent', compact('upload_error'));
} else {
$Feature1 = $this->upload->data();
$image_path = base_url('uploads/' . $Feature1['raw_name'] . $Feature1['file_ext']);
$post['image_path'] = $image_path;
}
if (!$this->upload->do_upload('banner')) {
$upload_error1 = $this->upload->display_errors();
$this->load->view('dashboard/pages/forms/addEvent', compact('upload_error1'));
} else {
$carsousel = $this->upload->data();
$banner = base_url('uploads/' . $carsousel['raw_name'] . $carsousel['file_ext']);
$post['banner'] = $banner;
}
$this->load->model('loginmodel', 'addNews');
$insert_id = $this->addNews->addNews($post);
if ($insert_id) {
$this->session->set_flashdata("addNewsSuccess", 'News & Event Added Successfully');
redirect('dashboard/update_news/' . $insert_id);
} else {
$this->session->set_flashdata("addNewsFailed", 'Failed');
$this->load->view('dashboard/pages/forms/addEvent');
}
} else {
$upload_error = $this->upload->display_errors();
$this->load->view('dashboard/pages/forms/addEvent', compact('upload_error'));
}
}
This is my model:
public function addNews($array)
{
$this->db->insert('news', $array);
return $this->db->insert_id();
}
My form validation are working perfectly but when user is uploading wrong file type or does not upload any file then file upload error message is not displaying and data is inserting into database the with both image field empty.
I am trying to make a register form for my website using PHP. Everything in the HTML code & most of the PHP code works fine, however, when I add the code for putting the data into the database the website does not work, instead, I get an error saying, 'HTTP ERROR 500'. What is wrong with my code that is making this happen?
Thanks in advance for your help.
My HTML Code:
<form role="form" method="post" id="msgform" action="phpcodes/register.php" autocomplete="off">
<fieldset>
<div class="row" style="width: 95%; margin: 0% 2.5%;">
<div class="form-group">
<input class="form-control" placeholder="First Name" value="" name="firstname" type="text" autofocus required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Last Name" name="lastname" type="text" value="" required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Email" name="email" type="email" value="" required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="" required>
</div>
<div class="form-group">
<input class="form-control" placeholder="Confirm Password" name="cpassword" type="password" value="" required>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="TERMS & CONDITIONS & PRIVACY POLICY" unchecked required />
<a style="text-align: right; color: black; text-decoration: none; font-size: 11px;">I have read & accept Teen Jobs TERMS & CONDITIONS & PRIVACY POLICY.</a>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="NZ WORK" unchecked required />
<a style="text-align: right; text-decoration: none; color: black; font-size: 11px;">I have the right to work in New Zealand & undertake employment.</a>
</label>
</div>
<button style="outline: none; background-color: #00a63f;" id="btn" class="btn btn-lg btn-success btn-block">REGISTER</button>
</fieldset>
</form>
My PHP Code:
<?php
session_start();
include('connection.php');
if(!$con)
{
echo "<br/>";
echo '<div class="alert alert-warning">Something went wrong, please try again!</div>';
}
else {
$fname= mysqli_real_escape_string($con,$_POST['firstname']);
$lname=mysqli_real_escape_string($con,$_POST['lastname']);
$email=mysqli_real_escape_string($con,$_POST['email']);
$pass=mysqli_real_escape_string($con,$_POST['password']);
$cpass=mysqli_real_escape_string($con,$_POST['cpassword']);
if($cpass!=$pass) {
echo "The two passwords entered do not match!";
}
else {
$result = $con->query("SELECT * FROM `signin` WHERE `email` = '$email'");
if($result->num_rows == 0) {
$query="INSERT INTO `signin`(`user_id`, `email`, `password`) VALUES (default,'$email','$pass')";
if(mysqli_query($con,$query)) {
$last_user_id="SELECT * `user_id` FROM `signin` ORDER BY `user_id` DESC LIMIT 1";
$result = mysqli_query($con,$last_user_id);
if(mysqli_num_rows($result)>0) {
while($row=mysqli_fetch_array($result)) {
$user_id = $row['user_id'];
$_SESSION['user_id']=$user_id;
echo $user_id;
}
}
else {
echo "NOT USER ID";
}
$query1="INSERT INTO `user_prfile`(`profile_id`, `firstname`, `lastname`, `user_id`) VALUES (default,'$fname','$lname','$user_id')";
if(mysqli_query($con,$query1)) {
header('Location: ../sign-in.php');
}
else {
echo '<div class="alert alert-warning">Data not inserted</div>';
}
}
else {
echo '<div class="alert alert-warning">Data not inserted</div>';
}
}
else {
echo '<div class="alert alert-warning">Data not inserted</div>';
}
}
else {
echo '<div class="alert alert-warning">That Email Already Exist.</div>';
}
}
}
?>
your conditions are not properly closed, there is no "if" for this "else"
else {
echo '<div class="alert alert-warning">That Email Already Exist.</div>';
}
}
You should look for a PHP editor that helps you to format the code properly and find inconsistences (MS Code maybe? or Brackets?).
I'm trying to upload a picture to my server and save the image name to my database. But if I fill in my form it just refreshes and does nothing. Does someone know why it doesn't save to the folder?
If my submit button is clicked I run this PHP code:
<?php
if(isset($_POST['btn_save_updates'])) {
$id = $_GET['id'];
$email = $_POST['email'];
$signature = $_POST['signature'];
//if they DID upload a file...
if($_FILES['avatar']['name'])
{
//if no errors...
if(!$_FILES['avatar']['error'])
{
//now is the time to modify the future file name and validate the file
$new_file_name = strtolower($_FILES['avatar']['tmp_name']); //rename file
if($_FILES['avatar']['size'] > (2048000)) //can't be larger than 1 MB
{
$valid_file = false;
$error = 'Oops! Your file\'s size is to large.';
}
//if the file has passed the test
if($valid_file)
{
//move it to where we want it to be
move_uploaded_file($_FILES['avatar']['tmp_name'], 'avatar/'.$new_file_name);
$filename = $_FILES['avatar']['name'];
// run update statement here ...
$error = 'Settings have been updated.';
}
}
//if there is an error...
else
{
//set that to be the returned message
$error = 'Oops! Error: '.$_FILES['avatar']['error'];
}
}
}
?>
HTML Form:
<form method="post" role="form" autocomplete="off">
<div class="form-group">
<label for="email">Email</label>
<input type="text" name="email" id="email" tabindex="1" class="form-control" value="<?php userProfile("email"); ?>" autocomplete="off">
</div>
<div class="form-group">
<label for="signature">Signature <i id="sign_tooltip" class="fa fa-exclamation-circle" aria-hidden="true" ata-toggle="tooltip" data-placement="right" title="You can add images to your signature!"></i></label>
<script>
$("#sign_tooltip").hover(function(){
$('#sign_tooltip').tooltip('show')
});
</script>
<textarea rows="4" name="signature" id="signature" tabindex="3" class="form-control" autocomplete="off"><?php userProfile("signature"); ?></textarea>
</div>
<br /><br />
<div class="form-group">
<label for="email">Avatar</label><br /><br />
<img src="avatars/<?php userInfo('avatar'); ?>" alt="Default Avatar" class="img-circle" width="140" height="140"><br /><br />
<input name="avatar" id="avatar" tabindex="4" class="input-group" type="file" accept="image/*" />
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-7">
</div>
<div class="col-xs-5 pull-right">
<button type="submit" name="btn_save_updates" id="btn_save_updates" tabindex="5" class="form-control btn btn-success"><i class="fa fa-floppy-o" aria-hidden="true"></i> Save </button>
</div>
</div>
</div>
</form>
You forgot to add enctype="multipart/form-data" to your form.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Hope someone can help. I have a profile page that I want to display the logged in users details. So far I have this on the Profile page.
<?php
/* This script pulls the existing name input and displays it when the user logs in. */
session_start();
include("db.php"); ?>
<?php include("includes/header.php") ?>
<?php include("includes/nav.php") ?>
<?php
if(logged_in()) {
$result = mysqli_query($link,$query);
$row = mysqli_fetch_array($result);
if (!$_POST['name'] && $_POST['name']=="") $error.="<br />Please enter your name";
if (!$_POST['email'] && $_POST['email']=="") $error.="<br />Please enter your email";
if (!$_POST['DOB'] && $_POST['DOB']=="") $error.="<br />Please enter your date of birth";
if (!$_POST['country'] && $_POST['country']=="") $error.="<br />Please enter your country";
if ($error) {
echo '<div class="alert alert-success alert-dismissable">'.addslashes($error).'</div>';
}
if(isset($_POST['form-control'])) {
move_uploaded_file($_FILES['file']['tmp_name'],"img/".$_FILES['file']['name']);
$query = mysqli_query("UPDATE users SET image = '".$_FILES['file']['name']."'");
}
} else {
redirect("login.php");
}
?>
<Style>
.alert{
display:none;
}
#profileimg {
height: 100px;
width: auto;
}
</Style>
<div class="container">
<h1>Edit Profile</h1>
<hr>
<div class="row">
<!-- left column -->
<div class="col-md-3">
<div class="text-center">
<img src="//placehold.it/100" class="avatar img-circle" alt="avatar" id="profileimg">
<h6>Upload a different photo...</h6>
<input class="form-control" type="file" name="name">
</div>
</div>
<!-- edit form column -->
<div class="col-md-9 personal-info">
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Profile updated.</strong>
</div>
<h3>Personal info</h3>
<form class="form-horizontal" role="form" action="edit_profile.php" method="post">
<div class="form-group">
<label class="col-lg-3 control-label name">name:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['name'];?>" type="text" name="name" required>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['email'];?>" type="text" name="email" required>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">DOB:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['DOB'];?>" type="date" name="DOB" required>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Country</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['country'];?>" type="text" name="country" required>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input class="btn btn-primary" value="Save Changes" type="submit">
<span></span>
<input class="btn btn-default" id="updated" value="Cancel" type="reset">
</div>
</div>
</form>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
$("#updated").click(function(){
$(".alert").hide().show('medium');
</script>
</body>
</html>
I then have another php file for the updating which is this:
<?php
session_start();
include("db.php");
$name = $_POST['name'];
$email = $_POST['email'];
$DOB = $_POST['DOB'];
$country = $_POST['country'];
$password = md5($salt.$_POST['password']);
$query = "UPDATE users SET name = '".$name."', email = '".$email."', DOB = '".$DOB."', country = '".$country."', password = '".$password."'";
$result = mysqli_query($link,$query);
header('Location: profile.php');
?>
So the short is it doesn't display or update and I am not sure why. I am new to PHP so go easy on me if this is simple, I have searched but can't seem to find the answer.
Thanks in advance.
Im also new to this but normally when I check if a SESSION id is active I use
if(isset($_SESSION['id'])) {
$query = "UPDATE users SET name = '".$name."', email = '".$email."', DOB = '".$DOB."', country = '".$country."', password = '".$password."' WHERE id='".$_SESSION['id']."'";
}
You also need to echo back the indexed rows that you are trying to query to display results
$name = row['username'];
echo $name;
There are lots of errors in your code: You are trying to upload a file in the same page whereas you send the form data to another page. How you handle form validation is also a little overhead. What I did change in the form is: I add name="save" in your submit button and added new hidden input for storing your user profile id. I am not sure what login() function did in your code, better stick to if($id){}.
Try this:
<?php
/* This script pulls the existing name input
and displays it when the user logs in. */
session_start();
include("db.php");
include("includes/header.php");
include("includes/nav.php");
$id = $_SESSION['id'];
if(loginned()) {//you can do if($id){}
$query="SELECT * FROM users WHERE id='$id' LIMIT 1";
$result = mysqli_query($link,$query);
$row = mysqli_fetch_array($result);
?>
<style>
.alert{
display:none;
}
#profileimg {
height: 100px;
width: auto;
}
</style>
<div class="container">
<h1>Edit Profile</h1>
<hr>
<div class="row">
<!-- left column -->
<!-- edit form column -->
<div class="col-md-9 personal-info">
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert"
aria-hidden="true">×</button>
<strong>Profile updated.</strong>
</div>
<h3>Personal info</h3>
<form class="form-horizontal" role="form"
action="edit_profile.php" method="post">
<div class="form-group">
<label class="col-lg-3 control-label name">name:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['name'];?>"
type="text" name="name" required>
</div>
</div>
<div class="col-md-3">
<div class="text-center">
<img src="//placehold.it/100" class="avatar
img-circle" alt="avatar" id="profileimg">
<h6>Upload a different photo...</h6>
<input class="form-control" type="file" name="name">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['email'];?>"
type="text" name="email" required>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">DOB:</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['DOB'];?>"
type="date" name="DOB" required>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Country</label>
<div class="col-lg-8">
<input class="form-control" value="<?php echo $row['country'];?>"
type="text" name="country" required>
</div>
</div>
<div class="form-group">
<input type="hidden" name="id" value="<?php echo $row['id'];?>">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input class="btn btn-primary" name="save"
value="Save Changes" type="submit">
<span></span>
<input class="btn btn-default" id="updated"
value="Cancel" type="reset">
</div>
</div>
</form>
</div>
<?php }else{ redirect("login.php"); } ?>
edit_profile.php First we check whether any post with a name of save is there, We validate the posted data. if validation is successful, we proceed to upload your file and then run your update query.
<?php
session_start();
include("db.php");
if(isset($_POST['save'])){
$id = isset($_POST['id'])? $_POST['id']:'';
$name = isset($_POST['name'])? $_POST['name']:'';
$email = isset($_POST['email'])? $_POST['email']:'';
$dob = isset($_POST['DOB'])? $_POST['DOB']:'';
$pass = isset($_POST['passwrd'])? md5($salt.$_POST['password']):'';
$country = isset($_POST['country'])? $_POST['country']:'';
if(empty($name)){
$error = 'Please enter your name';
}elseif(empty($email)){
$error = 'Please enter your email';
}elseif(empty($dob)){
$error = 'Please enter your date of birth';
}elseif(empty($country)){
$error = 'Please enter your country';
}elseif(empty($pass)){
$error = 'Please enter your password';
}else{
move_uploaded_file($_FILES['file']['tmp_name'],"img/".$_FILES['file']['name']);
$query = mysqli_query("UPDATE users SET image = '".$_FILES['file']['name']."'
WHERE id='$id'");
$query = "UPDATE users SET name = '$name', email = '$email',
DOB = '$DOB', country = '$country', password = '$password'
WHERE id='$id'";
$result = mysqli_query($link,$query);
header('Location: profile.php');
}
}
?>
<?php if(!empty($error)){
echo '<div class="alert alert-success
alert-dismissable">'.addslashes($error).'</div>';
}else{
echo '<div class="alert alert-success">Success</div>';
}
?>
I have added a demo here. At least this will help:
I'm trying to upload 3 images to my server
I have 3 file inputs in the same form.
so far, I receive the following parameters through post (3 images)
$license_img, $car_pic, $driver_pic
And here I try to upload thouse images to server.
if($license_img!= '') {
$license_decoded = base64_decode($license_img);
$license_pic_path = '....images/licenses/'.$email.'.jpg';
file_put_contents($license_pic_path, $license_decoded);
}
if($driver_pic != '') {
$driver_decoded = base64_decode($driver_pic);
$driver_pic_path ='....images/profiles/'.$email.'.jpg';
file_put_contents($driver_pic_path, $driver_decoded);
}
if($car_pic != '') {
$car_decoded = base64_decode($car_pic);
$car_pic_path = '....images/cars/'.$email.'.jpg';
file_put_contents($car_pic_path, $car_decoded);
}
In another script I upload one picture with file_put_content and it works just fine...
How is the right way to upload multiple images with one form?
Update
<script>
function getPicture(img) {
var file = document.getElementById(img);
file.click(); // open file
}
function onImgSelected(event) {
var pieces = event.target.value.split("\\\");
var filename = pieces[pieces.length-1];
if(event.target.id == "driver_img") {
document.getElementById("path_driver_img").value = filename;
} else if(event.target.id == "car_img"){
document.getElementById("path_car_img").value = filename;
} else {
document.getElementById("path_licenta_img").value = filename;
}
}
</script>
<!-- accept="jpeg,jpg,png,bmp" -->
<input type="file" style="display: none" accept="jpeg,jpg,png,bmp" name="driver_img" id="driver_img" onChange="onImgSelected(event)" />
<input type="file" style="display: none" accept="jpeg,jpg,png,bmp" name="car_img" id="car_img" onChange="onImgSelected(event)" />
<input type="file" style="display: none" accept="jpeg,jpg,png,bmp" name="license_img" id="license_img" onChange="onImgSelected(event)" />
<div class="form-group col-xs-12 space-bottom">
<label class="control-label">Driver Picture</label>
<div class="input-group">
<input type="text" class="form-control" id="path_driver_img" readonly>
<span class="input-group-btn">
<button class="btn btn-default" onClick="getPicture(\'driver_img\')" type="button">Up</button>
</span>
</div>
</div>
<div class="form-group col-xs-12 space-bottom">
<label class="control-label">Car Picture</label>
<div class="input-group">
<input type="text" class="form-control" id="path_car_img" readonly>
<span class="input-group-btn">
<button class="btn btn-default" onClick="getPicture(\'car_img\')" type="button">Up</button>
</span>
</div>
</div>
<div class="form-group col-xs-12 space-bottom">
<label class="control-label">Taxi License Image <font color="red">*</font></label>
<div class="input-group">
<input type="text" class="form-control" id="path_licenta_img" readonly>
<span class="input-group-btn">
<button class="btn btn-default" onClick="getPicture(\'license_img\')" type="button">Up</button>
</span>
</div>
</div>
</div>
<div class="col-xs-12"><br>
<div class="col-xs-12" align="center"> <input type="submit" value="Submit" class="btn btn-success btn-md"></div>
</div>
This is a very simple script for uploading images
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file01" /><br />
<input type="file" name="file02" /><br />
<input type="file" name="file03" /><br />
<input type="text" name="text" /><br />
<input type="submit" value="Upload images" />
</form>
<?php
echo '$_FILES:'."<br /><pre>";
var_dump($_FILES);
echo "</pre>";
echo '$_POST:'."<br /><pre>";
var_dump($_POST);
echo "</pre>";