You want to provide an option to upload an image on the product pages of your store.
You can show some extra content on your product page with the help of metafields. StoreHippo provides the metafield functionality to provide additional data on the storefront and extended field in the admin panel. To provide the image upload field on the product page, you are required to create a metafield and then display it on the storefront.
Follow the below steps to add the metafield to a product page:
<div v-if="product?.metafields?.metafield_name">
<ms-form-file-upload :field="{'name':'metafield_name'}" :data="product.selected_options">
<input type="file" @change="handleFileChange" id="metafield_id" placeholder="ms.filters.translate('Upload Image')" autocomplete="off" />
</ms-form-file-upload>
</div>
<div class="form-group" ng-if="product.metafields.<metafield_name> == 1">
<div ms-widget="ms.instantFileUpload">
<label class="option-name">Upload Image</label>
<input type="file" id="file" name="<metafield_name>"
ng-model="product.selected_options['<metafield_name>']" required/>
<div ng-if="uploading">
<p><i class="text-center ms-p-xs">
<span class="fa fa-cog fa-spin ms-mr-xs"></span>
<b> File is Uploading....</b></i>
</p>
</div>
<div ng-if="!uploading">
<div ng-if="previewUrl">
<img ng-src="{{previewUrl}}" style="height:100px;"/>
</div>
</div>
</div>
</div>