Php 重新加载页面后保留文件上载值

Php 重新加载页面后保留文件上载值,php,html,Php,Html,我有一个巨大的表单,允许用户(以及许多其他输入)上传多个图像,如下所示: <input type="file" id="product_images" class="hidden" name="upload[]" multiple> <input type="file" id="product_images_2" class="hidden" name="upload[]" multiple> ... <input type="file" id="product

我有一个巨大的表单,允许用户(以及许多其他输入)上传多个图像,如下所示:

<input type="file" id="product_images" class="hidden" name="upload[]" multiple>
<input type="file" id="product_images_2" class="hidden" name="upload[]" multiple>
... 
<input type="file" id="product_images" name="upload[]" multiple value="<?php print($_POST['upload']); ?>">

但没有起作用。有什么想法吗?谢谢

可能是因为您正在服务器中验证,请尝试在浏览器中验证您的字段,如果服务器重新加载,则会丢失保存在字段中的所有数据

亲自尝试此验证器我喜欢它:

Hop it help

$\u会话[“图像路径”]=$\u POST[“上传”];
$_SESSION["image_path"] = $_POST['upload'];
<input type="file" id="product_images"<?php values= if(empty($_session['image_path'])) {} else { echo $_session['image_path']; } ?>class="hidden" name="upload[]">

尝试在输入栏中使用有助于您的
模式
,您可以非常轻松地完成此操作


这将不起作用(如果我理解正确的话),由于安全原因,您不能这样做。一定有办法至少保留选定的文件路径吗?我想Ajax是唯一的解决方案?在提交之前在会话中保存该图像路径,这里有一些有用的链接:但如果用户在浏览器中禁用javascript怎么办?如果发生这种情况,你最好放一个警告,比如“如果你看到这条消息是因为你在浏览器中禁用了javascript”。或者类似的。现在没有人禁用javascript。
$_SESSION["image_path"] = $_POST['upload'];
<input type="file" id="product_images"<?php values= if(empty($_session['image_path'])) {} else { echo $_session['image_path']; } ?>class="hidden" name="upload[]">