R8VI
asked on
upload progress information from server real time asp.net, c#
hi,
I want to know how i can progress information for a server as i am doing a file upload and want to create a progress bar.
Thanks,
R8VI
I want to know how i can progress information for a server as i am doing a file upload and want to create a progress bar.
Thanks,
R8VI
ASKER
see my problem is i dont really want to pay for one so might have toi try the other one lol
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks emoreau,
just wondering if you have used this component, and if so could you guide me as i have a file upload component that i use to upload my files this is the one provide within Visual studios so how would i integrate the progress bar with that component
Thanks
R8VI
just wondering if you have used this component, and if so could you guide me as i have a file upload component that i use to upload my files this is the one provide within Visual studios so how would i integrate the progress bar with that component
Thanks
R8VI
I have used it more then 2 years ago. The web site as a couple of example for you to quickly integrate it into your own application. You won't have to use the file upload component that is provided with VS anymore.
ASKER
oh ok so could you give me a code example if possible
There is a user manual on the Neat Upload site with code examples.
http://www.brettle.com/NeatUpload-1.3/dotnet/docs/Manual.html#3.2.Using NeatUpload with the Visual Studio Web Form Designer|outline
http://www.brettle.com/NeatUpload-1.3/dotnet/docs/Manual.html#3.2.Using NeatUpload with the Visual Studio Web Form Designer|outline
ASKER
hi,
thanks for all the help so far. now i am using neatupload I have the following code
aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Brettle.Web.Neat Upload" Namespace="Brettle.Web.Nea tUpload"
TagPrefix="Upload" %>
<!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>
<Upload:InputFile ID="inptfileupload" runat="server" />
</div>
<script type="text/javascript">
function UpdateUrlsAndDisplayProgre ss()
{
var inlineProgressBar = document.getElementById("p rgbar");
var nuf = NeatUploadForm.prototype.G etFor(inli neProgress Bar, '<%= prgbar.PostBackID %>');
var link1 = document.getElementById("l ink1");
var link2 = document.getElementById("l ink2");
var link3 = document.getElementById("l ink3");
link1.href = nuf.ChangePostBackIDInUrl( link1.href , "NeatUpload_PostBackID");
link2.href = nuf.ChangePostBackIDInUrl( link2.href , "NeatUpload_PostBackID");
link3.href = nuf.ChangePostBackIDInUrl( link3.href , "NeatUpload_PostBackID");
NeatUploadPB.prototype.Bar s['prgbar' ].Display( );
}
</script>
<Upload:ProgressBar ID="prgbar" runat="server" />
<p>
</p>
<asp:Button ID="btnsubmit" runat="server" Text="Button" />
</form>
</body>
</html>
c# code
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;
using System.Web.SessionState;
using Brettle.Web.NeatUpload;
public partial class _Default : System.Web.UI.Page
{
protected HtmlGenericControl uploadedFilePre;
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.P age_Load);
}
private void Page_Load(object sender, EventArgs e)
{
btnsubmit.Click += new System.EventHandler(this.b tnsubmit_C lick);
if (!IsPostBack && Request.Params["processing "] == "true")
{
DoProcessing();
}
}
private void DoProcessing()
{
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
//ProgressInfo progress = inlineProgressBar.Processi ngProgress = new ProgressInfo(5000, "Units");
for (int i = 1; i <= 5000; i++)
{
System.Threading.Thread.Sl eep(1);
progress.Value = i;
}
progress.Text = "Processing Complete";
}
private void btnsubmit_Click(object sender, EventArgs e)
{
DoProcessing();
uploadedFilePre.InnerText = "";
if (inptfileupload.HasFile)
{
uploadedFilePre.InnerText += " Name: " + inptfileupload.FileName + "\n";
uploadedFilePre.InnerText += " Size: " + inptfileupload.ContentLeng th + "\n";
uploadedFilePre.InnerText += " Content type: " + inptfileupload.ContentType + "\n";
}
}
}
but keep getting error
Object reference not set to an instance of an object. on line
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
please help
Thanks,
R8VI
thanks for all the help so far. now i am using neatupload I have the following code
aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
<%@ Register Assembly="Brettle.Web.Neat
TagPrefix="Upload" %>
<!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>
<Upload:InputFile ID="inptfileupload" runat="server" />
</div>
<script type="text/javascript">
function UpdateUrlsAndDisplayProgre
{
var inlineProgressBar = document.getElementById("p
var nuf = NeatUploadForm.prototype.G
var link1 = document.getElementById("l
var link2 = document.getElementById("l
var link3 = document.getElementById("l
link1.href = nuf.ChangePostBackIDInUrl(
link2.href = nuf.ChangePostBackIDInUrl(
link3.href = nuf.ChangePostBackIDInUrl(
NeatUploadPB.prototype.Bar
}
</script>
<Upload:ProgressBar ID="prgbar" runat="server" />
<p>
</p>
<asp:Button ID="btnsubmit" runat="server" Text="Button" />
</form>
</body>
</html>
c# code
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.
using System.Xml.Linq;
using System.Web.SessionState;
using Brettle.Web.NeatUpload;
public partial class _Default : System.Web.UI.Page
{
protected HtmlGenericControl uploadedFilePre;
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.P
}
private void Page_Load(object sender, EventArgs e)
{
btnsubmit.Click += new System.EventHandler(this.b
if (!IsPostBack && Request.Params["processing
{
DoProcessing();
}
}
private void DoProcessing()
{
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
//ProgressInfo progress = inlineProgressBar.Processi
for (int i = 1; i <= 5000; i++)
{
System.Threading.Thread.Sl
progress.Value = i;
}
progress.Text = "Processing Complete";
}
private void btnsubmit_Click(object sender, EventArgs e)
{
DoProcessing();
uploadedFilePre.InnerText = "";
if (inptfileupload.HasFile)
{
uploadedFilePre.InnerText += " Name: " + inptfileupload.FileName + "\n";
uploadedFilePre.InnerText += " Size: " + inptfileupload.ContentLeng
uploadedFilePre.InnerText += " Content type: " + inptfileupload.ContentType
}
}
}
but keep getting error
Object reference not set to an instance of an object. on line
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
please help
Thanks,
R8VI
where do you get the error?
ASKER
hi
i get the error on the following line
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
error is
Object reference not set to an instance of an object. on line
i get the error on the following line
ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
error is
Object reference not set to an instance of an object. on line
http://www.obout.com/fup/index.aspx
The alternative would be to create your own upload form using an iFrame and javascript, which can be found here.
http://geekswithblogs.net/rashid/archive/2007/08/01/Create-An-Ajax-Style-File-Upload.aspx