Codeigniter CSRF error: “action requested not allowed.” - php

My site was working just fine, no issues, then all of a sudden I receive error "An Error Was Encountered - The action you have requested is not allowed" during every form submit.
I am using Codeigniter 3 with SSL and I have CSRF protection turned on. I did not change anything lately so I have no idea why my site stopped working. If I turn CSRF off, form submission works fine.
Settings
$config['base_url'] = 'https://www.mywebsite.com';
$config['index_page'] = '';
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '.mywebsite.com';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'msmm_tn';
$config['csrf_cookie_name'] = 'msmm_cn';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
Form
<form action="https://www.mywebsite.com/" class="navbar-form navbar-left" id="search" method="post" accept-charset="utf-8">
<input type="hidden" name="msmm_tn" value="caeea1bc65c09f29691a1a692e09a30a" style="display:none;" />
<input type="hidden" name="token" value="ada2832a" style="display:none;" />
<input type="hidden" name="date-search-form" id="date-search-form" value="X">
<div class="form-group">
<input type="date" class="form-control input-md" name="from_date" id="from_date" value="2017-08-15" />
</div>
<div class="form-group">
<input type="date" class="form-control input-md" name="to_date" id="to_date" value="2017-08-16" />
</div>
<div class="form-group">
<input type="search" class="form-control input-md" name="search_text" id="search_text" placeholder="Search" value="">
</div>
<div class="form-group">
<button type="submit" class="btn btn-default btn-sm" name="go" id="go"><i class="fa fa-search" aria-hidden="true"></i>
</button>
</div>
</form>
</div>
Server side form code:
<?php
$attributes = array('class' => 'form-horizontal', 'id' => 'signup');
echo form_open('', $attributes);
?>
<?php
if( isset( $login_error_mesg ) )
{
echo '<div class="alert alert-danger input_bump" role="alert">';
echo 'Invalid Username, Email Address, or Password.<br>Username, email address and password are all case sensitive.';
echo '</div>';
}
if( $this->input->get('logout') )
{
echo '<div class="alert alert-success input_bump text-center" role="alert"><p>You have successfully logged out.</p></div>';
}
?>
<div class="form-group form-padding">
<label class="form-label" for="login_name">User Name or Email</label>
<input type="text" class="form-control form-fixer input-md" name="login_string" id="login_string" value="<?php echo $this->input->post('login_string'); ?>">
</div>
<div class="form-group form-padding">
<label class="form-label" for="pwd">Password</label>
<input type="password" class="form-control input-md" id="login_pass" name="login_pass" maxlength="<?php echo config_item('max_chars_for_password'); ?>" autocomplete="off" />
</div>
<div class="input_bump">
<?php
$link_protocol = USE_SSL ? 'https' : NULL;
?>
<p>
Can't access your account?
</p>
</div>
<div class="form-group form-padding">
<button type="submit" class="btn btn-success btn-full">Sign In</button>
</div>
<?php echo form_close(); ?>

Just add the Controller uri in:
$config['csrf_exclude_uris'] = array();
//e.g. $config['csrf_exclude_uris'] = array('register/add_member');
Where register is your controller and add_member is the method.

Related

i've a problem with my form that i tried validating it with php then it should send the data to the firebase

it always gives me the first condition which gives me "Name Cannot be empty." and it dosen't send the data...
i tried changing the $_POST['inputs'] with variables but everytime it gives me undefined index
inside the script there's the code that sends the data to firebase
what seems to be the problem here
<form class="pb-5 ml-5" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST">
<input type="text" class="form-control text-right" id="inputName" name="inputName">
<label for="staticEmail" class="col-sm-3 col-form-label text-left">الإسم</label>
<input type="email" class="form-control text-right" id="inputEmail" name="inputEmail">
<label for="staticEmail" class="col-sm-3 col-form-label text-left" >الإيميل</label>
<input type="password" class="form-control text-right" id="inputPassword" name="inputPassword">
<label for="staticPassword" class="col-sm-3 col-form-label text-left">كلمة المرور</label>
<input type="tel" id="inputNum" class="form-control text-right" name="inputNum">
<label for="staticNum" class="col-sm-3 col-form-label text-left" >رقم الموبايل</label>
<input type="hidden" name="form_submitted" value="1" />
<input type="button" value="اشترك" class="btn btn-danger w-50 mr-5" id="create-newuser-button" name="createUser">
</form>
</section>
</div>
<?php
$nameEmptyErr = $emailEmptyErr = $mobNumEmptyErr = $passwordEmptyErr = "";
$nameErr = $emailErr = $mobNumErr = $passwordErr = "";
$validation = true;
//Name Validation
if (empty($_POST['inputName'])) {
$nameEmptyErr = '<div class="error">
Name cannot be empty.
</div>';
echo $nameEmptyErr;
} else {
$name = test_input($_POST['inputName']);
//Email Validation
if (empty($_POST['inputEmail'])) {
$emailEmptyErr = '<div class="error">
Email cannot be empty.
</div>';
echo $emailEmptyErr;
} else {
$email = test_input($_POST['inputEmail']);
//Password Validation
if (empty($_POST['inputPassword'])) {
$passwordEmptyErr = '<div class="error">
Password cannot be empty.
</div>';
echo $passwordEmptyErr;
} else {
$password = test_input($_POST['inputPassword']);
//Mobile Number Validation
if (empty($_POST['inputNum'])) {
$mobNumEmptyErr = '<div class="error">
Mobile Number cannot be empty.
</div>';
echo $mobNumEmptyErr;
} else {
$mobNum = test_input($_POST['inputNum']);
$validation = true;
}
}
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
if (isset($_POST['createUser']) && $validation = true) :
?>
<script type='text/javascript'></script>
<?php
endif;
?>
Your page isn't testing to see if it has been submitted. As a result it displays your form and immediately starts validating the parameters - which aren't yet there.
You also don't seem to have a submit button, so there's no way to submit the form. If you have such a button you can test for it and do the validation if you find it.
Rework your page like this:
// Add a test for the presence of the submit button.
//If not found, display a form, otherwise do the validation
if (!isset($_POST['createUser'])) {
?>
<div>
<section>
<!-- No need to specify an action if the form is submitting to the same page. -->
<form class="pb-5 ml-5" method="POST">
<input type="text" class="form-control text-right" id="inputName" name="inputName">
<label for="staticEmail" class="col-sm-3 col-form-label text-left">الإسم</label>
<input type="email" class="form-control text-right" id="inputEmail" name="inputEmail">
<label for="staticEmail" class="col-sm-3 col-form-label text-left" >الإيميل</label>
<input type="password" class="form-control text-right" id="inputPassword" name="inputPassword">
<label for="staticPassword" class="col-sm-3 col-form-label text-left">كلمة المرور</label>
<input type="tel" id="inputNum" class="form-control text-right" name="inputNum">
<label for="staticNum" class="col-sm-3 col-form-label text-left" >رقم الموبايل</label>
<input type="hidden" name="form_submitted" value="1" />
<!-- Change this element to type="submit" -->
<input type="submit" value="اشترك" class="btn btn-danger w-50 mr-5" id="create-newuser-button" name="createUser">
</form>
</section>
</div>
<?php
} else {
// Do your validation here
}

how can i write inside a tag in html from php in different files?

I am learning to program in PHP and I have a problem, I want to write in a html tag from php in different files, but I don't get how to do it. This is my code:
index.php
<form action="back_end_files/ControllerUsuarios.php" method="post">
<div class="input-group form-group">
<input type="email" class="form-control" id="loginEmail" placeholder="Email"
onfocusout="validatesLogin()" name="vEmail" required/>
</div>
<div class="input-group form-group">
<input type="password" class="form-control " id="loginPassword" placeholder="Password"
name="vPass" required>
</div>
<div>
<p id="status"></p>
</div>
<div class="alert">
<?php echo isset($alert) ? $alert : ''; ?>
</div>
<div class="form-group">
<button class="btn btn-primary btn-sm float-right" type="submit" name="submitLogin">
Login
</button>
</div>
<div class="form-group">
</div>
</form>
Here i want to write the message
<div>
<p id="status"></p>
</div>
controllerUsuarios.php
function loginCase(){
require 'DAOUsuarios.php';
$connection = new DAOUsuarios();
$connection->connectDB();
$username = $_POST['vEmail'];
$pass = $_POST['vPass'];
if($connection->login($username,$pass, $connection) == true){
session_start();
$_SESSION['active'] = true;
$_SESSION['email'] = $username;
header("Location: https://localhost/logged.php");
}
else{
$alert = "Email or password incorrect";
}
}
basically. post to the same index file is easiest, redirect if authenticated, otherwise just show the form again.
index.php
<?php
// include your login functions...
require 'back_end_files/controllerUsuarios.php';
if(logged_in()) {
// already logged in.
header("Location: https://localhost/logged.php");
} else {
// this will redirect if authenticated.
loginCase();
}
?>
<form action="index.php" method="post">
<div class="input-group form-group">
<input type="email" class="form-control" id="loginEmail" placeholder="Email" onfocusout="validatesLogin()" name="vEmail" required/>
</div>
<div class="input-group form-group">
<input type="password" class="form-control " id="loginPassword" placeholder="Password"
name="vPass" required>
</div>
<div>
<p id="status"></p>
</div>
<div class="alert">
<?php echo isset($alert) ? $alert : ''; ?>
</div>
<div class="form-group">
<button class="btn btn-primary btn-sm float-right" type="submit" name="submitLogin">
Login
</button>
</div>
<div class="form-group">
</div>
</form>
back_end_files/controllerUsuarios.php
/**
* check logged in now
*
* #return boolean if logged in.
**/
function logged_in() {
session_start();
return !empty($_SESSION['active']);
}
/**
* log in the user and goto the next page or show form again.
*
* #return void
**/
function loginCase(){
require 'DAOUsuarios.php';
$connection = new DAOUsuarios();
$connection->connectDB();
// only try to authenticate if the data is set.
if(!empty($_POST['vEmail']) && !empty($_POST['vPass'])) {
$username = $_POST['vEmail'];
$pass = $_POST['vPass'];
if($connection->login($username,$pass, $connection) == true){
$_SESSION['active'] = true;
$_SESSION['email'] = $username;
header("Location: https://localhost/logged.php");
}
}
// did not authenticate, so show the form again.
return false;
}

Load a specific div on id base codeigniter

myiamge
I have 2 forms as tab in signup page when one form is submit and if have any error I want to redirect to that specific tab which have error but did not happen.
Here is my view
<?php include 'header.php'; ?>
<section class="services">
<div class="container">
<div class="signup-wrapper well" style="margin-bottom: 80px; margin-top: 80px;">
<div class="container">
<div class="services__main">
<h2 class="title title--main"><span class="title__bold">Sign Up</span><span class="line line--title"><span class="line__first"></span><span class="line__second"></span></span></h2>
</div>
<div class="aside-tabs__links">
Genrel User
Dealership
</div>
<div class="aside-tabs__blocks about-tab js-tab-block no-b-border" id="desc" >
<div class="col-md-5">
<form action="<?= base_url();?>Home/add_user" method="post" >
<!-- class="quick-form" -->
<div class="form-group">
<input type="text" class="form-control" name="fname" placeholder="Full Name" />
</div>
<?php echo form_error('fname'); ?>
<div class="form-group">
<input type="email" class="form-control" name="email" placeholder="Email" />
</div>
<?php echo form_error('email'); ?>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="Password" />
</div>
<?php echo form_error('password'); ?>
<div class="form-group">
<input type="text" class="form-control" name="phone" placeholder="Phone #" />
</div>
<?php echo form_error('phone'); ?>
<div class="form-group">
<select class="select-2 form-control" name="city">
<option>Select City</option>
<?php foreach ($results as $result) { ?>
<option><?= $result->city; ?></option>
<?php } ?>
</select>
</div>
<?php echo form_error('city'); ?>
<div class="form-group">
<input type="submit" class="btn button button--red button--main pull-right" style="margin-bottom: 10px;" value="Sign Up">
</div>
</form>
</div>
</div>
<div class="aside-tabs__blocks about-tab js-tab-block no-b-border" id="rev" style="display: none;">
<div class="col-xs-5">
<form action="<?= base_url();?>Home/add_dealer" method="post" enctype="multipart/form-data">
<h4>Comapny Information</h4>
<hr>
<div class="form-group">
<input type="text" class="form-control" name="cname" placeholder="Company Name" />
</div>
<div class="form-group">
<input type="text" class="form-control" name="owner" placeholder="Owner Name" />
</div>
<div class="form-group">
<select class="select-2 form-control" name="city">
<option>Select City</option>
<?php foreach ($results as $result) { ?>
<option><?= $result->city; ?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" name="address" placeholder="Office Location" />
</div>
<div class="form-group">
<input type="text" class="form-control" name="phone" placeholder="Office Phone" />
</div>
<div class="form-group">
<select name="business-type" class="form-control">
<option class="form-group">Products Deal</option>
<option class="form-group">Bikes</option>
<option class="form-group">Accessories</option>
<option class="form-group">Both</option>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" name="link" placeholder="social-link(optional)" />
</div>
<div class="form-group">
<button type="button" class="button button--custom--grey button--main btn" id="logo">Upload Logo</button>
<input type="file" class="form-control hidden" id="logo1" name="logo1" /><span id="mylogo">* Format must be jpg,jpeg or png</span>
</div>
<?php echo form_error('logo'); ?>
<div class="form-group">
<textarea class="form-control" name="descrp" placeholder="Description(optional)"></textarea>
</div>
<h4>Primary Information</h4>
<hr>
<div class="form-group">
<input type="text" class="form-control" name="email" placeholder="Email" />
</div>
<div class="form-group">
<input type="text" class="form-control" name="password" placeholder="Password" />
</div>
<div class="form-group">
<input type="submit" name="submit" class="btn button button--red button--main pull-right" value="Sign Up">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include 'footer.php'; ?>
here is my controller
function add_dealer()
{
//echo "<pre>"; print_r($_FILES);
$config['upload_path'] = 'C:\xampp\htdocs\devilbirds\images\uploads';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['encrypt_name'] = 'TRUE';
$config['overwrite'] = 'FALSE';
$config['wm_text'] = 'Deveil Birds';
$config['wm_type'] = 'text';
$config['wm_font_path'] = 'C:\xampp\htdocs\devilbirds/fonts/fontawesome-webfont.ttf';
$config['wm_font_size'] = '16';
$config['wm_font_color'] = 'aabbcc';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '20';
$this->load->library('upload', $config);
$this->image_lib->watermark();
$abc = $this->upload->do_upload('logo1');
$upload_data = $this->upload->data();
// var_dump($abc);exit();
$file_name = $upload_data['file_name'];
$this->form_validation->set_rules('cname','CName','trim|required');
$this->form_validation->set_rules('logo1','Logo1','trim');
$this->form_validation->set_rules('address','Address','trim');
$this->form_validation->set_rules('phone','Phone','trim|is_unique[bd_dealer.phone]');
$this->form_validation->set_rules('owner','Owner','trim');
$this->form_validation->set_rules('descrp','Descrp','trim');
$this->form_validation->set_rules('business-type','Business-type','trim');
$this->form_validation->set_rules('link','Link','trim');
$this->form_validation->set_rules('email','Email','trim|is_unique[bd_dealer.email]');
$this->form_validation->set_rules('password','Password','trim|min_length[5]|max_length[20]');
$this->form_validation->set_rules('city','City','trim');
if ($this->form_validation->run() == FALSE)
{
$data['error'] = $this->session->set_flashdata('errors');
$this->load->view('pages/signup',$data);// this is the link which loads my view i dont get how to go load that specific div from this url
}
else
{
$userData = array(
'company' => $this->input->post('cname'),
'logo' => $file_name,
'location' => $this->input->post('address'),
'phone' => $this->input->post('phone'),
'name' => $this->input->post('owner'),
'description' => $this->input->post('descrp'),
'business_type' => $this->input->post('business-type'),
'social_link' => $this->input->post('link'),
'email' => $this->input->post('email'),
'password' => $this->input->post('password'),
'city' => $this->input->post('city'));
$data = array(
'email' => $this->input->post('email'),
'password' => $this->input->post('password'),
'user_type' => '2');
//var_dump($userData);exit();
$this->Home_m->add_dealer($userData);
$this->Home_m->users($data);
redirect('Home/login');
}
}
I have two functions for two different forms in tabs. let suppose if i post my dealer form and this form have any issue then it will redirect to the signup page and it shows the pre-active tab which is general user signup. i want to redirect to the div that contain the form or dealer signup. any help will be appreciated , thanks in advance
In your controller when you get error do this.
for form one error
$data['error'] = $this->session->set_flashdata('errors');
$data['div1'] = "div1";
$this->load->view('pages/signup',$data);// this is the link which loads my view i dont get how to go load that specific div from this url ,i have pass div1 as parameter
For form two error
$data['error'] = $this->session->set_flashdata('errors');
$data['div2'] = "div2";
$this->load->view('pages/signup',$data);// this is the link which loads my view i dont get how to go load that specific div from this url ,i have pass div1 as parameter
In your view page
<script>
$(document).ready(function(){
var div1 = "<?php $div1; ?>";
var div2 = "<?php $div2; ?>";
if(div1=='' && div2==''){
$("#desc").show();
$("#rev").hide();
}else if(div1=='div1' && div2==''){
$("#desc").show();
$("#rev").hide();
}else if(div1=='' && div2=='div2'){
$("#desc").hide();
$("#rev").show();
}
})
</script>
div1
<div class="aside-tabs__blocks about-tab js-tab-block no-b-border" id="desc">
Div2
<div class="aside-tabs__blocks about-tab js-tab-block no-b-border" id="rev">
I hope it will help you.

php_fetch redirection failed?

I'm very new to php. when I try to register a form through php. the data
s are submitted to database but the redirection to a particular page is failed.
I have my login form named as index.php in root directory. and my registration form in second level directory. and my registration form control is in first level of directory. I used php_fetch for url sanitize. Here is my folder structure -
root->inc(folder)
->index.php
inc(folder)->pages(folder)
->registration.con.php
pages(folder)->registrster.php
here is my form controls
<form class="js-validation-register form-horizontal push-50-t push-50" action="<?php echo esc_url($_SERVER['PHP_SELF']); ?>" method="post" name="registration_form">
<div class="form-group">
<div class="col-xs-12">
<div class="form-material form-material-success">
<input class="form-control" type="text" id="username" name="username" placeholder="Please enter a username">
<label for="username">Username</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<div class="form-material form-material-success">
<input class="form-control" type="email" id="email" name="email" placeholder="Please provide your email">
<label for="email">Email</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<div class="form-material form-material-success">
<input class="form-control" type="password" id="password" name="password" placeholder="Choose a strong password..">
<label for="password">Password</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<div class="form-material form-material-success">
<input class="form-control" type="password" id="confirmpwd" name="confirmpwd" placeholder="..and confirm it">
<label for="register-password2">Confirm Password</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<label class="css-input switch switch-sm switch-success">
<input type="checkbox" id="register-terms" name="register-terms"><span></span> I agree with terms & conditions
</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-12 col-sm-6 col-md-5">
<input class="btn btn-block btn-success" type="button"
value="Register"
onclick="return regformhash(this.form,
this.form.username,
this.form.email,
this.form.password,
this.form.confirmpwd);" />
</div>
</div>
</form>
here is my php_fwtch function
function esc_url($url) {
if ('' == $url) {
return $url;
}
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%#$\|*\'()\\x80-\\xff]|i', '', $url);
$strip = array('%0d', '%0a', '%0D', '%0A');
$url = (string) $url;
$count = 1;
while ($count) {
$url = str_replace($strip, '', $url, $count);
}
$url = str_replace(';//', '://', $url);
$url = htmlentities($url);
$url = str_replace('&', '&', $url);
$url = str_replace("'", ''', $url);
if ($url[0] !== '/') {
// We're only interested in relative links from $_SERVER['PHP_SELF']
return '';
} else {
return $url;
}
}
as you can see when i register a form on success it should redirect me to ../../index.php but insted it redirects me to ../index.php where registeration.con.php and functions exsits..!
this error is im getting on sucessful registration..
Not Found
The requested URL /src3/inc/index.php was not found on this server.
i know it is redirecting to index page on inc folder.. but i have to redirect it to index page on the root directory..
please help me..

PHP - how to upload 3 images with 3 inputs in one form php

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>";

Categories