我有三个页:
在文件选择页添加要上传的文件,在确认页检查文件内容,在完成页上传文件。
问题是,在确认页如何再次保留第一页选择的文件?
尝试在确认页用隐藏标签传递文件参数,但在完成页接收的时候,这样做:
params[:file].original_filename
# here I am using ruby
却提示无法识别 original_filename
的错误。显然,不从确认页真正用文件标签选择一下文件的话,下一个动作似乎无法识别到文件类型。
PHP中文网2017-04-24 09:11:40
If the page is synchronized, putting the source file name in a hidden tag will not achieve real file upload.
Two ways:
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.
You can choose to use ajax to make three pages into one page.