change template to display filename
3 posts
• Page 1 of 1
change template to display filename
Hi, in the product template there is this code for an upload option:
Does anyone please know what to add to this so that once an image file is uploaded on the product page that it displays the name of the file or even better a little thumbnail of the image?
Thanks for any help on this.
- Code: Select all
<?php if ($options) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'file') { ?>
<script type="text/javascript"><!--
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
action: 'index.php?route=product/product/upload',
name: 'file',
autoSubmit: true,
responseType: 'json',
onSubmit: function(file, extension) {
$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/default/image/loading.gif" class="loading" style="padding-left: 5px;" />');
},
onComplete: function(file, json) {
$('.error').remove();
if (json.success) {
alert(json.success);
$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json.file);
}
if (json.error) {
$('#option-<?php echo $option['product_option_id']; ?>').after('<span class="error">' + json.error + '</span>');
}
$('.loading').remove();
}
});
//--></script>
<?php } ?>
<?php } ?>
<?php } ?>
Does anyone please know what to add to this so that once an image file is uploaded on the product page that it displays the name of the file or even better a little thumbnail of the image?
Thanks for any help on this.

Website Design, hosting, seo and online marketing visit: http://www.yorkcreative.co.uk
- jonah
- Posts: 23
- Joined: Sat Feb 18, 2012 4:54 pm
Re: change template to display filename
Hi,
Im also looking for this feature, any progress?
What I have figured out is;
image is being uploaded to
/download
folder at the root
with following kind of random name
1337691777_personal.png.b580555d10b49763ee44e19becaec798
after successful upload, the upload form element getting the following value;
<input type="hidden" value="ZmRlampuYmlqa5Shl6WnpJ+Tn2Kln5lhlmppYmhpapVjY5ZpamlpZ5qWZmeZZmqUmJeWlpVqbW0=" name="option[404]">
I think what we have to do is, to figure out the relationship btw these to have the file name which has uploaded to /download folder
I will get back soon if I make any progress.
Best Wishes!
Im also looking for this feature, any progress?
What I have figured out is;
image is being uploaded to
/download
folder at the root
with following kind of random name
1337691777_personal.png.b580555d10b49763ee44e19becaec798
after successful upload, the upload form element getting the following value;
<input type="hidden" value="ZmRlampuYmlqa5Shl6WnpJ+Tn2Kln5lhlmppYmhpapVjY5ZpamlpZ5qWZmeZZmqUmJeWlpVqbW0=" name="option[404]">
I think what we have to do is, to figure out the relationship btw these to have the file name which has uploaded to /download folder

I will get back soon if I make any progress.
Best Wishes!
- ogov
- Posts: 4
- Joined: Sat Nov 26, 2011 3:12 pm
Re: change template to display filename
I have found the
upload php script
at the controller/product/product.php
and see OC is adding a . md5(rand()) after file extension
and also encrypting the json value to for the following reason
"// Hide the uploaded file name sop people can not link to it directly."
Thats clever
Now here comes a choice for us, will we ignore the risk?
or be safe with OC defaults
Best wishes!
upload php script
at the controller/product/product.php
and see OC is adding a . md5(rand()) after file extension
and also encrypting the json value to for the following reason
"// Hide the uploaded file name sop people can not link to it directly."
Thats clever

Now here comes a choice for us, will we ignore the risk?
or be safe with OC defaults

Best wishes!
- ogov
- Posts: 4
- Joined: Sat Nov 26, 2011 3:12 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google Feedfetcher and 20 guests













