0
<form  action="original_photo_upload.php" method="POST" id="form" name="form"   class="form-horizontal" style="margin-top: 20px;">
<div class="form-group">
    <label class="control-label col-xs-4">File Upload</label>
    <div class="col-md-8">
        <div class="fileupload fileupload-new" data-provides="fileupload">
            <div class="input-append">
                <div class="uneditable-input">
                    <i class="fa fa-file fileupload-exists"></i>
                    <span class="fileupload-preview"></span>
                </div>
                <span class="btn btn-default btn-file">
                    <span class="fileupload-exists">Change</span>
                    <span class="fileupload-new">Select file</span>
                    <input type="file">
                </span>
                <a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">Remove</a>
            </div>
        </div>
    </div>
</div>
</form>

I want insert the image value in Db and move the photo in one folder ,i know normal form but bootsrap i having confusing,how to get the image value in original_photo_upload.php

Raja R
  • 21
  • 6

2 Answers2

0

Change your form to:

<form form action="original_photo_upload.php" method="post" enctype="multipart/form-data" class="form-horizontal" style="margin-top: 20px;">

Also change your input to:

<input name="file" type="file">

Your form, need a submit to send the data. So, add:

<input type="submit" value="ok">

And in his file: original_photo_upload.php make one condition. Something like:

<?php
if (isset($_FILES['file'])){
    var_dump($_FILES);
}

For testing only.

UPDATE
To perform an upload:

move_uploaded_file($_FILES['file']['tmp_name'], 'upload/' . $_FILES['file']['name']);
AD Henrique
  • 186
  • 2
  • 13
  • var_dump($_FILES);//array(1) { ["file"]=> array(5) { ["name"]=> string(12) "DSC05019.JPG" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(24) "C:\xampp\tmp\phpFBD5.tmp" ["error"]=> int(0) ["size"]=> int(4165988) } } How to get the filename only – Raja R Nov 25 '15 at 12:48
  • K i got it thanks... – Raja R Nov 25 '15 at 12:50
  • To get the filename, use: `echo $_FILES['file']['name'];` But, If you want to perform an upload, you will need the tmp_name. I updated my answer. Look! – AD Henrique Nov 25 '15 at 12:57
0

<form  action="original_photo_upload.php" enctype='multipart/form-data' method="POST" id="form" name="form"   class="form-horizontal" style="margin-top: 20px;">
<div class="form-group">
    <label class="control-label col-xs-4">File Upload</label>
    <div class="col-md-8">
        <div class="fileupload fileupload-new" data-provides="fileupload">
            <div class="input-append">
                <div class="uneditable-input">
                    <i class="fa fa-file fileupload-exists"></i>
                    <span class="fileupload-preview"></span>
                </div>
                <span class="btn btn-default btn-file">
                    <span class="fileupload-exists">Change</span>
                    <span class="fileupload-new">Select file</span>
                    <input type="file" name="image">
                </span>
                <input type="button" class="btn btn-default fileupload-exists" data-dismiss="fileupload" value="submit">
                <input type="button" class="btn btn-default fileupload-exists" data-dismiss="fileupload" value="remove">
                </div>
        </div>
    </div>
</div>
</form>

and php query

<?php if(isset($_POST['submit']))
{
$ImageName = $_FILES['image']['name'];
$path = 'images/'; 
$location = $path . $_FILES['image']['name']; 
move_uploaded_file($_FILES['image']['tmp_name'], $location); 
} ?>

and more detail search image upload function.

Virendra Nagda
  • 673
  • 5
  • 9