File upload in product-template.liquid

New Member
1 0 0

Hi, I can't find any new information about file uploading, I know I'm missing this part enctype="multipart/form-data" and know it should be insine <form......>

But in new code I can't figure there it should be. Any sugestions?

 {% form enctype="multipart/form-data", 'product', product, class:'product-form' %}
         
            <select name="id" id="ProductSelect-{{ section.id }}" class="product-single__variants">
              {% for variant in product.variants %}
                {% if variant.available %}
                  <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
                {% else %}
                  <option disabled="disabled">
                    {{ variant.title }} - {{ 'products.product.sold_out' | t }}
                  </option>
                {% endif %}
              {% endfor %}
            </select>
           
           
          <p class="line-item-property__field">
<label for="custom_photo">Photo (JPG or PNG)</label>
<input required id="custom_photo" type="file" name="properties[Photo]">
</p>    

            {% if section.settings.product_quantity_enable %}
              <div class="product-single__quantity">
                <label for="Quantity">{{ 'products.product.quantity' | t }}</label>
                <input type="number" id="Quantity" name="quantity" value="1" min="1">
              </div>
            {% endif %}

            <div class="product-single__cart-submit-wrapper{% if section.settings.enable_payment_button %} product-single__shopify-payment-btn{% endif %}{% if section.settings.add_to_cart_width == 'full_width' %} product-form--full{% endif %}">
              <button type="submit" name="add" id="AddToCart"class="btn product-single__cart-submit{% if section.settings.add_to_cart_width == 'full_width' %} btn--full{% endif %}{% if section.settings.enable_payment_button %} shopify-payment-btn btn--secondary{% endif %}">
                <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
              </button>
              {% if section.settings.enable_payment_button %}
                {{ form | payment_button }}
              {% endif %}
                 </div>

          {% endform %}

0 Likes
New Member
2 0 1

I have the same problem. Can someone please help with this new code????

0 Likes
Tourist
6 0 0

Please, someone, reply........It's very important issue

0 Likes
Tourist
6 0 0

Still no answer from any expert??

0 Likes
New Member
1 0 0

I also have same problem. How to add a file upload field on product page?

0 Likes
New Member
1 0 0
{% form enctype: 'multipart/form-data', 'product', product, class:'product-form' %}
0 Likes