I am using Opencart Version 2.0.3.1.
Customer can upload image (upload file option)
in product page. I want to preview the uploaded image
in the same page. The uploaded image is saved to system/upload
folder and renamed with the filename + some string.
How can I preview the uploaded image.
The file upload button code is:(catalog/view/theme/default/template/product.product.tpl)
<?php if ($option['type'] == 'file') { ?>
<div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
<label class="control-label"><?php echo $option['name']; ?></label>
<button type="button" id="button-upload<?php echo $option['product_option_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default btn-block"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
<input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" id="input-option<?php echo $option['product_option_id']; ?>" />
</div>
<?php } ?>