Commit f32759d4 by taufikyu

perbaiki conflict script file size dan preview

1 parent 11fb0f7d
...@@ -15,10 +15,7 @@ ...@@ -15,10 +15,7 @@
tal:attributes="style style; tal:attributes="style style;
accept accept|field.widget.accept; accept accept|field.widget.accept;
data-filename fname; data-filename fname;
attributes|field.widget.attributes|{};" attributes|field.widget.attributes|{};"/>
onchange="document.getElementById('preview-'+this.id).src = window.URL.createObjectURL(this.files[0]);
document.getElementById('labeldelete-'+this.id).remove();
document.getElementById('label-'+this.id).remove();"/>
<input tal:define="uid cstruct.get('uid')" <input tal:define="uid cstruct.get('uid')"
tal:condition="uid" tal:condition="uid"
type="hidden" name="uid" value="${uid}"/> type="hidden" name="uid" value="${uid}"/>
...@@ -29,9 +26,13 @@ ...@@ -29,9 +26,13 @@
}); });
document.getElementById("${oid}").onchange = function() { document.getElementById("${oid}").onchange = function() {
if(this.files[0].size > ${maxsize}){ if(this.files[0].size > ${maxsize}){
alert("File is too big!"); alert("File is too big!");
this.value = ""; this.value = "";
document.getElementById('preview-'+this.id).src = '';
} }
document.getElementById('preview-'+this.id).src = window.URL.createObjectURL(this.files[0]);
document.getElementById('labeldelete-'+this.id).remove();
document.getElementById('label-'+this.id).remove();
}; };
</script> </script>
</tal:block> </tal:block>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!