Capture data before file upload

C

Chip

I need to time a file upload using the 1.X HTML upload control. So I need
the time the upload started, which is problematic since no page processing
takes place until after the file is uploaded. Is there a way to write to the
form (lblUploadStartTime) before the upload begins using Javascript -- using
the OnClick of the Submit button? I'm not experienced with JS, so if there
is a way to do this please let me know the JS syntax.
 
M

Michael Kolias

Server Side Code, In the Page_Load sub add this:
yourSubmitButton.Attributes.Add("onclick", "registerUploadTime();")

Client Side Code, Inside the head tag add this:
<script type="text/javascript">
function registerUploadTime()
{
document.getElementById('lblUploadStartTime').innerText = Date();
}
</script>
 
C

Chip

Thanks. This does work... sort of. The value is being wrtten to the label
onclick, but the data is not surviving the trip to the server for some
reason. If I unhide the label, I can see it flash the date and then
disappear when the page is served by the server. Any server side code sees
the label as empty.

It would seem intuitive that if the label held data before being posted, it
should be seen by the server. There is obviously something fundatmental that
I'm missing here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top