作者:灰太狼老婆红太狼_715 | 来源:互联网 | 2023-09-11 19:38
IhaveanappwithCarrierwaveonHeroku.Onapage,Ihave2forms:1ajaxformforuploadingapic
I have an app with Carrierwave on Heroku. On a page, I have 2 forms: 1 ajax form for uploading a picture and 1 normal form for additional information needed to create the object. Suppose my Carrierwave mount is :picture
, every time the ajax form is submitted, the picture is saved temporarily into the public folder and its path is returned as :picture_cache
. The second form then uses that to know which picture to be created with the new object on the second request. This works fine for a single dyno.
我有一个在Heroku上有Carrierwave的应用。在一个页面上,我有两个表单:一个用于上传图片的ajax表单,另一个用于创建对象所需的其他信息的普通表单。假设我的Carrierwave mount是:picture,每次提交ajax表单时,图片都会被临时保存到公共文件夹中,其路径返回为:picture_cache。然后,第二个表单使用它来知道在第二个请求中使用新对象创建哪个图片。这适用于单个dyno。
Different dynos don't know about each other's filesystems. Thus if the request to submit the 2nd form doesn't hit the same dyno as the request of the first form, it can't find the image.
不同的dynos不知道彼此的文件系统。因此,如果提交第2个表单的请求与第一个表单的请求不匹配,则无法找到图像。
Has anyone tackled this problem?
有人解决过这个问题吗?
1 个解决方案