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
R8VIAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
you can use this one for free: http://www.brettle.com/neatupload
0
 
aibusinesssolutionsCommented:
I've had good luck with the obout.com file upload progress bar.

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
0
 
R8VIAuthor Commented:
see my problem is i dont really want to pay for one so might have toi try the other one lol
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
R8VIAuthor Commented:
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
0
 
Éric MoreauSenior .Net ConsultantCommented:
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.
0
 
R8VIAuthor Commented:
oh ok so could you give me a code example if possible
0
 
aibusinesssolutionsCommented:
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
0
 
R8VIAuthor Commented:
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.NeatUpload" Namespace="Brettle.Web.NeatUpload"
    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 UpdateUrlsAndDisplayProgress()
            {
                  var inlineProgressBar = document.getElementById("prgbar");
                  var nuf = NeatUploadForm.prototype.GetFor(inlineProgressBar, '<%= prgbar.PostBackID %>');
                  var link1 = document.getElementById("link1");
                  var link2 = document.getElementById("link2");
                  var link3 = document.getElementById("link3");
                  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.Bars['prgbar'].Display();
            }
            </script>
    <Upload:ProgressBar ID="prgbar" runat="server" />
    <p>
        &nbsp;</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.Page_Load);
            }
            
            private void Page_Load(object sender, EventArgs e)
            {
            btnsubmit.Click += new System.EventHandler(this.btnsubmit_Click);
                  if (!IsPostBack && Request.Params["processing"] == "true")
                  {
                        DoProcessing();
                  }
            }
            
            private void DoProcessing()
            {
            ProgressInfo progress = prgbar.ProcessingProgress = new ProgressInfo(5000, "Units");
            //ProgressInfo progress = inlineProgressBar.ProcessingProgress = new ProgressInfo(5000, "Units");
                  for (int i = 1; i <= 5000; i++)
                  {
                        System.Threading.Thread.Sleep(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.ContentLength + "\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
0
 
Éric MoreauSenior .Net ConsultantCommented:
where do you get the error?
0
 
R8VIAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.