php - 如何将值保留在 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">
我的预期结果是它应该在提交后将文件上传值保留在表单中,以保存重新提交文件。实际结果是提交后文件上传并没有保存在表单中
解决方案
推荐阅读
- python - 使用 Flask 和 Google Colab 渲染 html 模板时出错
- elasticsearch - 模式捕获不适用于正斜杠
- powershell - 导出 .CSV 文件,更改与导入相同的名称和文件夹
- encryption - 使用 ColdFusion 调用 Sage Pay API 时出错
- laravel - 如何使用 eloquent laravel 过滤两个日期之间的数据?
- java - 活动随时可用
- reactjs - 如何在 JEST 中测试 Window.postMessage()?
- javascript - IndexedDB - 如何在对象存储中读取最大 ID
- python - 根据索引从一列中选择第一个值,从第二个中选择最后一个值
- node.js - 在 Express 和 Axios 中使用 JSON 发布文件(图片)