Hi,
I have checked your code.
You have know how to use the guid list.
Please check this sample , you will know how to do it directly :
-
<%@ Page Language="C#" %>
-
-
<%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<script runat="server">
-
-
protected override void OnInit(EventArgs e)
-
{
-
if (Request.HttpMethod == "POST" && !Page.IsPostBack)
-
{
-
string guidstr=Request.Form["ajaxfileguid"];
-
if (guidstr != null)
-
{
-
//OK it's ajax call, handle it and end response:
-
Guid guid = new Guid(guidstr);
-
ServerAjaxProcessFile(guid);
-
}
-
}
-
base.OnInit(e);
-
}
-
-
private void ServerAjaxProcessFile(Guid guid)
-
{
-
//use MvcUploader to get file by guid:
-
CuteWebUI.MvcUploader uploader = new MvcUploader(Context);
-
CuteWebUI.MvcUploadFile file = uploader.GetUploadedFile(guid);
-
-
//process it
-
//file.MoveTo("somewhere/filename.ext")
-
file.Delete();
-
-
Response.Write("Server side message : File uploaded : " + file.FileName);
-
Response.End();
-
}
-
-
</script>
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head runat="server">
-
<title>Untitled Page</title>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
-
<div>
-
<CuteWebUI:Uploader runat="server" ID="Uploader1" MultipleFilesUpload="true">
-
</CuteWebUI:Uploader>
-
</div>
-
<div id="statusdiv">
-
</div>
-
</form>
-
-
<script type="text/javascript">
-
-
function ShowMessage(msg)
-
{
-
var statusdiv=document.getElementById("statusdiv");
-
statusdiv.innerHTML="";
-
statusdiv.appendChild(document.createTextNode(msg));
-
}
-
-
function ClientAjaxProcessFile(guid)
-
{
-
var xh;
-
if(window.XMLHttpRequest)
-
xh=new XMLHttpRequest();
-
else
-
xh=new ActiveXObject("Microsoft.XMLHTTP");
-
-
//this is just an sample, use current page to handle the request
-
var ajaxurl=document.forms["form1"].action;
-
xh.open("POST",ajaxurl,false);
-
xh.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
-
xh.send("ajaxfileguid="+guid);
-
alert(xh.responseText);
-
}
-
-
function CuteWebUI_AjaxUploader_OnTaskStart(obj)
-
{
-
ShowMessage("Start : "+obj.FileName);
-
}
-
function CuteWebUI_AjaxUploader_OnTaskComplete(obj)
-
{
-
ShowMessage("Complete : "+obj.FileName+" : "+obj.FileGuid);
-
-
ClientAjaxProcessFile(obj.FileGuid);
-
}
-
function CuteWebUI_AjaxUploader_OnTaskError(obj,msg,reason)
-
{
-
if(msg==null)msg="File has been cancelled";
-
ShowMessage("Error : "+obj.FileName+" : "+msg);
-
}
-
-
function CuteWebUI_AjaxUploader_OnPostback()
-
{
-
//clear the queue
-
this.reset();
-
//cancel postback while the ajax call have processed the files.
-
return false;
-
}
-
-
</script>
-
-
</body>
-
</html>
Regards,
Terry