[英]Rails: How to use one form file_field to upload multiple selected files at once?
I'm trying to make an image heavy web app that allows you to upload multiple images. 我正在尝试制作一个图像丰富的Web应用程序,该应用程序允许您上传多个图像。 However, I don't want to pollute my site with a bunch of
file_field
s because it looks ugly and is also inconvenient, since the user has to upload multiple pics one by one like that. 但是,我不想用一堆
file_field
来污染我的网站,因为它看起来很丑并且也不方便,因为用户必须像这样一个人上传多个图片。 Is there a way to make it so that when you click the file_field box that you can select/highlight multiple files at once and upload them all at once? 有没有一种方法可以使您在单击file_field框时一次选择/突出显示多个文件并一次上传所有文件? If so, how would I target each uploaded image so that I can display each of them?
如果是这样,我将如何定位每个上载的图像,以便可以显示它们?
Short answer: you can't. 简短的答案:您不能。
field_field
just elaborates into input
tags of type file
which, by specification, can only load a single file at a time. field_field
只是详细说明了file
类型的input
标签,根据规范,一次只能加载一个文件。
You can, though, have a look at other solutions which can be fit into a Rails application such as jQuery-File-Upload or Plupload 不过,您可以查看其他适合Rails应用程序的解决方案,例如jQuery-File-Upload或Plupload
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.