首页 > 解决方案 > 如何将值保留在 php 文件上传的表单中

问题描述

我试图在提交后将文件上传值保留在表单中。

我尝试使用 $_SESSION 将上传文件添加为值。提交后,我可以毫不费力地将其他输入的值保留在表单中,而不是文件上传。

<form id = '##' action='##.php' method='post' enctype='multipart/form-data'>
        Upload logo:<br>
        <input type='file' name='fileToUpload' class = 'file' id='fileToUpload' value="<?PHP echo $_SESSION['##']; ?>">


<label>###</label>
    <div class = 'input'><input type = 'text'  id = '###' name = '###' value = "<?PHP echo $_SESSION['###']; ?>" placeholder=" ex: #####"></div><br>


<input type="submit" id = 'submit' name="submit">

我的预期结果是它应该在提交后将文件上传值保留在表单中,以保存重新提交文件。实际结果是提交后文件上传并没有保存在表单中

标签: phphtml

解决方案


推荐阅读