File Upload Progress Indicator ?

M

Marko Vuksanovic

I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 
B

Bruno Alexandre

why don't you have an Animated GIF in the UpdateProgress Panel ?

--

Bruno Alexandre
(a Portuguese in Kobenhanv, Danmark)


"Marko Vuksanovic" <[email protected]> escreveu na mensagem I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 
J

John Timney \(MVP\)

if you do a google search for Ajax progress bar you'll find lots of examples, like this one.

http://www.wilcob.com/Wilco/Default/159/showpost.aspx

-
Regards

John Timney (MVP)
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 
B

bruce barker \(sqlwork.com\)

this will be tricker than you may think. ajax progress bars work by polling the server for status of the operation. to poll the status of an upload you need to poll the server for how far along it is. there are a couple issues

1) as IIS streams the request to asp.net, asp.net does not give a handy way to get the request stream in progress. you will proably have to write an isapi filter to get the number of bytes transfered.

2) the client may not send the size of the file, so the server will not know how big it is to calc how far along the transfer is.

3) while the request (upload) is in progress, the browser may not allow the ajax code to make another request.

-- bruce (sqlwork.com)
if you do a google search for Ajax progress bar you'll find lots of examples, like this one.

http://www.wilcob.com/Wilco/Default/159/showpost.aspx

-
Regards

John Timney (MVP)
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 
M

Marko Vuksanovic

Thank you all very much for the suggestions,

The UpdateProgress Panel is actually good enough. All I want to achieve is to notify the user that the file is being uploaded and that they need to wait a while.

Best regards,
Marko Vuksanovic.


this will be tricker than you may think. ajax progress bars work by polling the server for status of the operation. to poll the status of an upload you need to poll the server for how far along it is. there are a couple issues

1) as IIS streams the request to asp.net, asp.net does not give a handy way to get the request stream in progress. you will proably have to write an isapi filter to get the number of bytes transfered.

2) the client may not send the size of the file, so the server will not know how big it is to calc how far along the transfer is.

3) while the request (upload) is in progress, the browser may not allow the ajax code to make another request.

-- bruce (sqlwork.com)
if you do a google search for Ajax progress bar you'll find lots of examples, like this one.

http://www.wilcob.com/Wilco/Default/159/showpost.aspx

-
Regards

John Timney (MVP)
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 
M

Marko Vuksanovic

I used the following code for implementing a file upload progress indicator, using UpdateProgress Panel, though I have a problem that FileUpload.Has File always returns false. Any suggestions what might be wrong?

FileUpload2.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileUpload2.aspx.cs" Inherits="FileUpload2" %>

<!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 id="Head1" runat="server">
<title> drag </title>

</head>
<body>

<form id="f1" enctype="multipart/form-data" runat="server">
<h4>Select a file to upload:</h4>

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<atlas:UpdatePanel ID="upResults" runat="server" Mode="conditional">
<Triggers>
<atlas:ControlEventTrigger ControlID="Upload" EventName="Click" />
</Triggers>
<ContentTemplate>
</ContentTemplate>
</atlas:UpdatePanel>


<asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>


<br /><br />


<asp:Button id="Upload" Text="Upload file" OnClick="UploadButton_Click" runat="server">
</asp:Button>
<atlas:UpdateProgress ID="uprProgress" runat="server">

<ProgressTemplate>
<img src="images/animated_loading.gif" /> Uploading....
</ProgressTemplate>
</atlas:UpdateProgress>


</form>
</body>
</html>

FileUpload2.aspx.cs

using .....;


public partial class FileUpload2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void UploadButton_Click(object sender, EventArgs e)
{
// Specify the path on the server to save the uploaded file to.
String savePath = @"C:\Temp\uploads\";
// Before attempting to perform operations on the file, verify that the FileUpload control contains a file.
if (FileUpload.HasFile)
{
String fileName = FileUpload.FileName;
savePath += fileName;
// Call the SaveAs method to save the uploaded file to the specified path.
FileUpload.SaveAs(savePath);
// Notify the user of the name of the file was saved under.
// UploadStatusLabel.Text = "Your file was saved as " + fileName;
}
else
{
// Notify the user that a file was not uploaded.
// UploadStatusLabel.Text = "You did not specify a file to upload.";
}
}
}

Any suggestions what might be wrong?

Thanks,
Marko Vuksanovic.

this will be tricker than you may think. ajax progress bars work by polling the server for status of the operation. to poll the status of an upload you need to poll the server for how far along it is. there are a couple issues

1) as IIS streams the request to asp.net, asp.net does not give a handy way to get the request stream in progress. you will proably have to write an isapi filter to get the number of bytes transfered.

2) the client may not send the size of the file, so the server will not know how big it is to calc how far along the transfer is.

3) while the request (upload) is in progress, the browser may not allow the ajax code to make another request.

-- bruce (sqlwork.com)
if you do a google search for Ajax progress bar you'll find lots of examples, like this one.

http://www.wilcob.com/Wilco/Default/159/showpost.aspx

-
Regards

John Timney (MVP)
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top