Hi,

I am using multiple uploads using uploadify (uploadify.com). I have checked
an example where Uploading is done with handler. I want to show all files on
the same page after completion of uploading without the postback. Can any
one suggest an idea or any help in code  or any link which may be helpful.

On Page HTML:
================================================

 <form id="form1" runat="server">
            <a
href="javascript:$('#<%=FileUpload1.ClientID%>').fileUploadStart()">Start
Upload</a>&nbsp;
           |&nbsp;<a
href="javascript:$('#<%=FileUpload1.ClientID%>').fileUploadClearQueue()">Clear</a>

            <div style = "padding:40px">
                <asp:FileUpload ID="FileUpload1" runat="server" />
            </div>
        </form>

<script type = "text/javascript">
$(window).load(
    function() {
        $("#<%=FileUpload1.ClientID%>").fileUpload({
        'uploader': 'scripts/uploader.swf',
        'cancelImg': 'images/cancel.png',
        'buttonText': 'Browse Files',
        'script': 'Upload.ashx',
        'folder': 'uploads',
        'fileDesc': 'Image Files',
        'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
        'multi': true,
        'auto': false
    });
   }
);
</script>

================================================
=================Handler Starts here===============================

public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        context.Response.Expires = -1;
        try
        {

            HttpPostedFile postedFile = context.Request.Files["Filedata"];

            string savepath = "";
            string tempPath = "";
            tempPath =
System.Configuration.ConfigurationManager.AppSettings["FolderPath"];
            savepath = context.Server.MapPath(tempPath);
            string filename = postedFile.FileName;
            if (!Directory.Exists(savepath))
                Directory.CreateDirectory(savepath);

            postedFile.SaveAs(savepath + @"\" + filename);
            context.Response.Write(tempPath + "/" + filename);
            context.Response.StatusCode = 200;

        }
        catch (Exception ex)
        {
            context.Response.Write("Error: " + ex.Message);
        }
    }


================================================

--
Jack

Reply via email to