我正在尝试从表单页面上传文件。如果我发布照片文件,它会在网上显示我的数据库,而只显示其中一个文件夹。
这是来自页面:
<script>
function changeValue(){
var x = document.getElementById("entercolor").value;
document.getElementById("html5colorpicker").value = x;
}
function changeValue2(){
document.getElementById("entercolor").value = '';
}
</script>
<div id="html5DIV">
<input id="html5colorpicker" name="user_color" class="form-control" onchange="clickColor(0, -1, -1, 5)" onclick="changeValue2()" value="<?php echo @$user['user_color'];?>" type="color"/>
</div>
<div id="entercolorDIV" class="input-group">
<input id="entercolor" style="width:50px" name="user_color2" class="text" placeholder="Spalvos kodas" value="<?php echo @$user['user_color'];?>" onfocus="clearWrongInput();" type="text"/>
<span class="input-group-btn">
<button class="btn btn-default" type="button" onclick="changeValue()">OK</button>
</span>
</div>
,帖子页面是
<form method="post" action="post_data.php" enctype="multipart/form-data">
<table align="center" class="monjey-tb">
<tr>
<td>
<label><span style="color:red">*</span>full name</label>
<input type="text" name="d_name" class="form-control" required /></td>
</tr>
<tr>
<td><br><label><span style="color:red">*</span>ID No.</label><input type="text" name="d_cpr" class="form-control" required /></td>
</tr>
<tr>
<td><br><label><span style="color:red">*</span>Address</label><input type="text" name="d_address" class="form-control" required /></td>
</tr>
<tr>
<td><br><label><span style="color:red">*</span>Mobile</label><input type="text" name="d_mobile" class="form-control" required /></td>
</tr>
<tr>
<td><br> <label><span style="color:red">*</span>Level</label> <div>
<select name="d_level" class="form-control" required>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</td>
</tr>
<tr>
<td><br><label><span style="color:red">*</span>Total</label><input type="text" name="d_total" class="form-control" required /></td>
</tr>
<td><br><label><span style="color:red">*</span>Photo1</label><input type="file" name="file" class="form-control" required/></td>
<tr>
</tr>
<td><br><label>photo2</label><input type="file" name="pphoto" class="form-control"/></td>
<tr>
</tr>
<td><br><label><span style="color:red">*</span>photo3</label><input type="file" name="certificate" class="form-control" required/></td>
<tr>
<td style="text-align: center"><br><button type="submit" name="submit"><strong class="j1">submint</strong></button></td>
</tr>
</table>
</form>
<?php
include_once 'dbconfig.php';
if(isset($_POST['submit']))
{
//extract($_POST);
$d_name = $_POST['d_name'];
$d_cpr = $_POST['d_cpr'];
$d_address = $_POST['d_address'];
$d_mobile = $_POST['d_mobile'];
$d_level = $_POST['d_level'];
$file = rand(1000,100000)."-".$_FILES['file']['name'];
$certificate = rand(1000,100000)."-".$_FILES['certificate']['name'];
$pphoto = rand(1000,100000)."-".$_FILES['pphoto']['name'];
$file_loc = $_FILES['file']['tmp_name'];
$file_loc2 = $_FILES['certificate']['tmp_name'];
$file_loc3 = $_FILES['pphoto']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
$folder="uploads/";
// variables for input data
$new_size = $file_size/1024;
$new_file_name = strtolower($file);
$final_file=str_replace(' ','-',$new_file_name);
if(move_uploaded_file($file_loc,$folder.$final_file))
{
if(move_uploaded_file($file_loc2,$folder.$final_file)){
if(move_uploaded_file($file_loc3,$folder.$final_file)){
// sql query for inserting data into database
$sql_query = "INSERT INTO users(d_name,d_cpr,d_address,d_mobile,d_level,file,type,size,certificate,pphoto)
VALUES('$d_name','$d_cpr','$d_address','$d_mobile','$d_level','$file','$file_type','$file_size','$certificate','$pphoto')";
mysql_query($sql_query);
header("Location: redir.php");
// sql query for inserting data into database
}
}
}
}
?>
附近的帖子页面上的问题。
我有3个文件
$ file_loc
和$ file_loc2
和$ file_loc3
答案 0 :(得分:1)
只需删除最后的Map<T, Set<Tuple<T, U>>> collect = tuples.stream().collect(
Collectors.groupingBy(Tuple::getFirst, Collectors.toSet()));
- 他们没有配对,但是太多了。