Add "FlashUpload.dll" to Bin folder of ASP.Net.
Upload.cs class
using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.SessionState;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.IO;
public
class Upload
: IHttpHandler,
IRequiresSessionState
{
public bool
IsReusable
{
get { return
true; }
}
public void
ProcessRequest(HttpContext context)
{
if ( context.Request.Files.Count > 0 )
{
for(int
j = 0; j < context.Request.Files.Count; j++)
{
HttpPostedFile uploadFile =
context.Request.Files[j];
if (uploadFile.ContentLength >
0)
{
uploadFile.SaveAs(context.Server.MapPath("~/Uploads/"+uploadFile.FileName));
}
}
}
}
}
Web.config
In
<system.web>
of config
file add the following tags
<httpHandlers>
<!--
The httpHandler that files are uploaded to, defined in App_Code/Upload.cs
-->
<remove
verb="POST,GET"
path="Upload.cs"/>
<add
verb="POST,GET"
path="Upload.cs"
type="Upload"/>
</httpHandlers>
<!--
The maximum files size allowed
-->
<httpRuntime
maxRequestLength="1550000"/>
<customErrors
mode="Off"
/>
Default.aspx
<%@
Page Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default"
EnableEventValidation="false"
%>
<%@
Register Assembly="FlashUpload"
Namespace="FlashUpload"
TagPrefix="FlashUpload"
%>
<!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
runat="server">
<title>Untitled
Page</title>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<asp:LinkButton
ID="LinkButton1"
runat="server"
Visible="False">LinkButton</asp:LinkButton>
<br
/>
<FlashUpload:FlashUpload
ID="flashUpload"
runat="server"
UploadPage="Upload.cs"
OnUploadComplete="UploadComplete()"
FileTypeDescription="Images"
FileTypes="*.*"
UploadFileSizeLimit="1800000"
TotalUploadSizeLimit="2097152"
/>
</div>
</form>
</body>
</html>
Default.aspx.cs
using
System;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
public
partial class
_Default : System.Web.UI.Page
{
protected void
Page_Load(object sender,
EventArgs e)
{
if (!IsPostBack)
{
string jscript =
"function UploadComplete(){" +
ClientScript.GetPostBackEventReference(LinkButton1,
"") +"};";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"FileCompleteUpload", jscript,
true);
}
}
}


omkar omblePosted Jan 26, 2023, 4:12 PM
Since flash has reached end of life and stopped by adobe on browsers now, what is the alternative to this flashupload functionality?
Manishkumar ChaudhariPosted Sep 2, 2015, 1:46 AM
i get's the soluation.. need to add below code in <system.webServer> for IIS7
Manishkumar ChaudhariPosted Sep 2, 2015, 1:03 AM
Hi am getting There has been an I/O Error: Error #2038 and There has been an HTTP Error: status code 404 error in IIS7 .. in IIS6 same code works fine.
deshraj singhPosted Jan 26, 2014, 11:56 PM
can i apply file limit in this application only one file upload at a time .......please reply fast
zpataftaeditedPosted Nov 7, 2012, 3:18 AMEdited Nov 7, 2012, 5:07 AM
Hi, Just wondering how to resolve compilation error:The name 'LinkButton1' does not exist in the current context.
Faisal AnsariPosted Oct 8, 2012, 2:57 AM
hi dear nice work , but i have some question about this, i am using this application for uploading images on server on file system and as well as image name and image path save in the sql server so if i upload 2 images simultaniously at a time with different machines its saved record with the same name while i have given different names ... i think its big bug ini this application
Faisal AnsariPosted Oct 8, 2012, 2:57 AM
hi dear nice work , but i have some question about this, i am using this application for uploading images on server on file system and as well as image name and image path save in the sql server so if i upload 2 images simultaniously at a time with different machines its saved record with the same name while i have given different names ... i think its big bug ini this application
Faisal AnsariPosted Aug 29, 2012, 3:32 AM
i got same error while i am deploying this app on iis the error is "There has been an I/O Error: Error #2038"
NileshPosted Nov 10, 2011, 6:37 AM
Hi..I got this error: There has been an I/O Error: Error #2038 when i try to run this on IIS7 can u please suggest me something.
Rajdeep PathakPosted May 31, 2011, 2:42 AM
Its Nice and working what I want to know is what is the use of FlashUpload.dll.What does it contain?If possible can you tell me please.My id id [email protected].
shadi mahPosted Mar 1, 2011, 11:14 AM
Hi raju, nice work.. but sometime i am receiving a script error "Object Expected" when try to click "Upload Files" button. The selected files are uploaded successfully but with this script error.. Please advice.. thx,
muhammad gaberPosted Jan 27, 2011, 5:47 AM
i don't think it's browser error i check it on IE & chrome still generate the same error could u help please?
muhammad gaberPosted Jan 27, 2011, 4:47 AM
it generate this error: There has been an I/O Error: Error #2038 (i gave it appropriate security level) There has been an HTTP Error: status code 404
muhammad gaberPosted Jan 27, 2011, 4:29 AM
thanks ..nice one
smitha pPosted Jan 20, 2011, 10:51 AM
I want college alumni source code using asp.net with c# and sqlserver2008