Hello Guys,
I use file attachment control in smartforms.Please let me know, how to get file size from an uploaded File.
Thanks,
Hello Guys,
I use file attachment control in smartforms.Please let me know, how to get file size from an uploaded File.
Thanks,
Hi BabyDev
There doesn't appear to be anyway to access this information OOB. The only way I can think is to implement some Javascript to retreive the attachment control's title attribute. The title attribute contains the file name, MIME Type and data size delimited by forward slashes. If you can retrieve the title for the HTML element using Javascript (perhaps by targeting the class if you only have one control) then you could possibly parse out the bit you want from the title.
Example HTML snippet for attachment control:
<label for="00000000-0000-0000-0000-000000000000_74408c28-492b-5909-cbff-7a100aff9527_file-inputId" style="height:54px;" class="file-label" title="TEST1.docx / (Microsoft Office Word Document) / 22.56 KB"> </label>
Dear,
According to
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<label for="00000000-0000-0000-0000-000000000000_ee2ae30b-d23f-cf88-9647-359a4d847577_file-inputId" style="height:54px;" class="file-label" title="Hover.txt / (Text Document) / 8.16 KB"> </label>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementsByTagName("label")[0].getAttribute("title");
var n = x.lastIndexOf("/");
var s = x.substring(n+1);
document.getElementById("demo").innerHTML = s;
}
</script>
</body>
</html>
you just need to modify it, I'm setting the result in <p> tag, add your datalabe and get it's ID through INSPECT ELEMENT from the browser so you can set it's innerHTML
RESULT:
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.