html - 如何在确认页面之后保存文件?
PHP中文网
PHP中文网 2017-04-24 09:09:40
0
1
806

我有三个页:

  • 文件选择页
  • 确认页
  • 完成页

在文件选择页添加要上传的文件,在确认页检查文件内容,在完成页上传文件。

问题是,在确认页如何再次保留第一页选择的文件?

尝试在确认页用隐藏标签传递文件参数,但在完成页接收的时候,这样做:

params[:file].original_filename
# here I am using ruby

却提示无法识别 original_filename 的错误。显然,不从确认页真正用文件标签选择一下文件的话,下一个动作似乎无法识别到文件类型。

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
洪涛

If the page is synchronized, putting the source file name in a hidden tag will not achieve real file upload.

Two ways:

  1. If you must use synchronization for page jumps, you can try saving the file in another model, and then finally save the model you want manually.

  2. You can choose to use ajax to make three pages into one page.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!