Shopify表单文件上传
我在页面模板上有此液体:
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="note success">Success!</p>
{% endif %}
{{ form.errors | default_errors }}
<p>
<label for="ContactFormName">Name</label>
<input type="text" id="ContactFormName" name="contact[name]" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.name }}{% endif %}" required>
</p>
<p>
<label for="ContactFormCV">Upload CV</label>
<input type="file" id="ContactFormCV" name="contact[cv]" required />
</p>
{% endform %}
问题是,当选择文件上传和提交的表单时,收到的电子邮件仅显示文件名。理想情况下,它应该附加文件或文件链接。
如果我将表单标签更改为此...
{% form 'contact', enctype: 'multipart/form-data' %}
...提交表单时会遇到此错误:
There was a problem loading this website
Try refreshing the page.
If the site still doesn't load, please try again in a few minutes.
如何使此错误工作?
注意:此表格正在模板目录(page.employment.liquid)中的自定义模板上使用。
I have this liquid on a page template:
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="note success">Success!</p>
{% endif %}
{{ form.errors | default_errors }}
<p>
<label for="ContactFormName">Name</label>
<input type="text" id="ContactFormName" name="contact[name]" value="{% if form[name_attr] %}{{ form[name_attr] }}{% elsif customer %}{{ customer.name }}{% endif %}" required>
</p>
<p>
<label for="ContactFormCV">Upload CV</label>
<input type="file" id="ContactFormCV" name="contact[cv]" required />
</p>
{% endform %}
The problem is that when a file is selected for upload and the form submitted, the email that is received only shows the file name. Ideally it should have the file attached, or a link to the file.
If I change the form tag to this...
{% form 'contact', enctype: 'multipart/form-data' %}
...I get this error when submitting a form:
There was a problem loading this website
Try refreshing the page.
If the site still doesn't load, please try again in a few minutes.
How can I get this to work?
Note: This form is being used on a custom template in the templates directory (page.employment.liquid).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,Shopify液体表格不接受文件输入类型。
您基本上有两个解决方案:
HTH
As far as I know, Shopify liquid forms do not accept file input type.
You have basically two solutions:
HTH