Php 我有3个文件上传输入在一个页面上,但他们保存相同的图像扩展名

Php 我有3个文件上传输入在一个页面上,但他们保存相同的图像扩展名,php,html,database,laravel,file-upload,Php,Html,Database,Laravel,File Upload,这是我的表格: <div class="form-group"> <label for="image_one">1st Product Image:</label> <input type="file" class="form-control" id="image_one" name="image_one" placeholder=&q

这是我的表格:

<div class="form-group">
<label for="image_one">1st Product Image:</label>
<input type="file" class="form-control" id="image_one" name="image_one" placeholder="image">
</div>
<div class="form-group">
<label for="image_two">2nd Product Image:</label>
<input type="file" class="form-control" id="image_two" name="image_two" placeholder="image">
</div>
<div class="form-group">
<label for="image_three">3rd Product Image:</label>
<input type="file" class="form-control" id="image_three" name="image_three" placeholder="image">
</div>
它仅在所有3个图像数据库列中保存我上载的第一个图像的扩展名


有人能帮我找出错误吗。提前感谢。

脚本必须运行得太快,使
time()
函数返回相同的内容,因此保存的图像名称相同(前提是图像具有相同的扩展名)

对所有三个图像使用
rand()
而不是
time()
,以生成它们的随机名称:

$filename = rand() . '.' . $extension;

在保存之前,您还可以检查随机名称是否不存在。

是否可以输入有关插入代码的更多信息?
$filename = rand() . '.' . $extension;