<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>
我希望在Db中插入图像值并将照片移动到一个文件夹中,我知道普通形式但是靴子我有困惑,如何在original_photo_upload.php中获取图像值
答案 0 :(得分:0)
将表单更改为:
<form form action="original_photo_upload.php" method="post" enctype="multipart/form-data" class="form-horizontal" style="margin-top: 20px;">
同时将您的输入更改为:
<input name="file" type="file">
您的表单,需要提交才能发送数据。所以,添加:
<input type="submit" value="ok">
在他的档案中:original_photo_upload.php提出了一个条件。类似的东西:
<?php
if (isset($_FILES['file'])){
var_dump($_FILES);
}
仅供测试。
<强>更新强>
要执行上传:
move_uploaded_file($_FILES['file']['tmp_name'], 'upload/' . $_FILES['file']['name']);
答案 1 :(得分: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>
和php查询
<?php if(isset($_POST['submit']))
{
$ImageName = $_FILES['image']['name'];
$path = 'images/';
$location = $path . $_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], $location);
} ?>
更详细的搜索图片上传功能。