Progress Bar help

G

Guest

Can someone please, please tell me how I get a progress bar to work with a
binary file upload!

I have the following code that uploads files into an SQL Database using a
Stored Procedure but I want to add a progress bar so users can see how long
the file takes to upload!

This would varey greatly depending on the size of the file! I would be very
grateful for any advice...

I'm reasonably new to ASP.NET but trying hard to learn so hope this isn't
too much of a stupid question...

I had a look at the following:

http://www.farsidestudios.com/Products/ProgressBar/

But don't know how to work it into my sub!

Thanks

CODE....

Sub UploadData(ByVal sender As Object, ByVal e As EventArgs)
Dim imgstream As Stream = ImageFile.PostedFile.InputStream
Dim imgdata(ImageFile.PostedFile.ContentLength) As Byte
imgstream.Read(imgdata, 0, ImageFile.PostedFile.ContentLength)

Dim MyConn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("fileUpload", MyConn)
cmd.CommandType = CommandType.StoredProcedure

Dim titleparam As New SqlParameter("@fileTitle", SqlDbType.NVarChar,
255)
Dim descriptionparam As New SqlParameter("@fileDescription",
SqlDbType.NVarChar, 255)
Dim Ownerparam As New SqlParameter("@fileOwner", SqlDbType.NVarChar,
255)
Dim Officeparam As New SqlParameter("@officeID", SqlDbType.Int)
Dim typeparam As New SqlParameter("@fileType", SqlDbType.NVarChar,
100)
Dim dataparam As New SqlParameter("@fileData", SqlDbType.Image)

titleparam.Value = ImageTitle.Text
descriptionparam.Value = fldDescription.Text
Ownerparam.Value = fldOwner.Text
Officeparam.Value = ddlOffice.SelectedIndex
typeparam.Value = ImageFile.PostedFile.ContentType
dataparam.Value = imgdata

cmd.Parameters.Add(titleparam)
cmd.Parameters.Add(descriptionparam)
cmd.Parameters.Add(Ownerparam)
cmd.Parameters.Add(Officeparam)
cmd.Parameters.Add(typeparam)
cmd.Parameters.Add(dataparam)

MyConn.Open()
cmd.ExecuteNonQuery()
MyConn.Close()
End Sub
 
B

Bruce Barker

a progress bar for an upload is much different than one for a long running
process. the typical web based progress bar work by posting back a request,
then polling the server for completion.

to do an upload progress bar, you need to to start the upload, and start a
poll at the the same time (uses frames). you will then need to replace the
..net fileuploader module with one of your own, that you can poll to get the
progess (say how may bytes transfered). one difficulity will be getting the
filesize, you will be depending on the browser sending the content length.

-- bruce (sqlwork.com)
 

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

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top