Ken, I tried your recommendation of using the
CuteWebUI_AjaxUploader_OnSelect javascript event. The problem with this is that when using the manual start upload approach, the
CuteWebUI_AjaxUploader_OnSelect event kicks off as soon as you select a file for upload but not when you click your button to submit and actually begin the upload. As a result, this event is too early. I am looking for a JS event that I can use which has
has access to the files selected for upload but that kicks off when uploadobj.startupload() is executed.
For example, I think I might be able to achieve this using this event:
function CuteWebUI_AjaxUploader_OnStart()
{
// Code goes here
}
But, I am not sure if I would be able to perform some code in the above mentioned event to perform the upload without going server side. Within the above JS event, I can access the AJAX uploader control with the key word this, can I use that to perform some JS code, for example, that would achieve the same thing as doinf this server side.
Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)
args.CopyTo("C:\\" & Date.Now.ToShortDateString().Replace("/", "") + ".pdf")
End Sub
Any thoughts? Thanks.
Kenneth: Hi mchamo,
Please try the example below. Function "CuteWebUI_AjaxUploader_OnSelect" will fire before the uploader control postback to the server. So you can execute your own script code in it before the "FileUploaded" event.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<CuteWebUI:Uploader ID="Uploader1" runat="server">
</CuteWebUI:Uploader>
</form>
</body>
</html>
<script>
function CuteWebUI_AjaxUploader_OnSelect(files)
{
alert("before postback!");
}
</script>
Regards,
ken