在以下情况下,如何在提交表单后获取$ _FILES数组数据? [英] How to get the $_FILES array data as it is after form submission in following scenario?

查看:67
本文介绍了在以下情况下,如何在提交表单后获取$ _FILES数组数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单中包含太多字段.这些字段之一如下:

I've a form with too many fields. One of these fields is as follows:

<form action="go_to_preview.php" role="form" method="post" enctype="multipart/form-data">
  <input type="file" name="equip_image" id="equip_image">
</form>

现在文件go_to_preview.php的目的是显示用户以标签形式填写的数据.所有填写的数据也包含在隐藏字段中.如果用户发现自己填写的内容是完美的,则用户单击文件go_to_preview.php上的提交"按钮.用户单击提交"按钮后,我会将通过$_POST接收到的数据添加到数据库中. 现在,我的问题与$_POST(这是存在于隐藏字段中的数据数组)一起,我希望原样来自$_FILES的数据.我应该如何实现呢?有人可以在这方面帮助我吗? 提前致谢.

Now the purpose of file go_to_preview.php is to show the data filled in by user in the form of labels. All the filled in data are also contained in hidden fields. If user finds whatever he/she has filled in is perfect then user clicks the submit button present on file go_to_preview.php. As soon as user clicks on submit button I'll add the data I received through $_POST to the database. Now my issue is along with $_POST(which is an array of data present into hidden fields) I want the data from $_FILES as it is. How should I achieve this? Can someone please help me in this regard? Thanks in advance.

推荐答案

常见的方法是会话:

//go_to_preview.php
session_start();
$_SESSION['FILES'] = $_FILES;

//final.php
session_start();
$files_var = $_SESSION['FILES'];
//use $files_var
unset($_SESSION['FILES']);

这篇关于在以下情况下,如何在提交表单后获取$ _FILES数组数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆