Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

File Upload

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 12 Feb 2008 02:40 GMT
Hello,

I need to upload a file. Can I only do this with the File Upload
control?

I also need the following:

- Send upload info, upload percentage, continuously to a JavaScript
function so I can display the Upload Progress.

- The controls would be inside an Update Panel.

 Before I start to upload a file I send data to a database. This is
done.

 After the data has been inserted in database the file upload would
start.

 The Upload Panel would "finish" when the file finishes upload.

Is this possible?

Could I get some help on this?

Thanks,

Miguel
Anthony Jones - 12 Feb 2008 10:29 GMT
> Hello,
>
[quoted text clipped - 5 lines]
> - Send upload info, upload percentage, continuously to a JavaScript
> function so I can display the Upload Progress.

Unfortunately there is currently no support in browsers to support this.
You would need an extra component installed on the client that can handle
the upload and provide a means of displaying a progress bar (typically a
progress event that can be consumes by the sites Javascript).

> - The controls would be inside an Update Panel.
>
[quoted text clipped - 3 lines]
>   After the data has been inserted in database the file upload would
> start.

What happens if the upload fails? Do you need to reverse out the DB changes?

Consider uploading to a temporary location first, then a post to the server
can update the database and move the file from its temporary location to its
persistent location in a more atomic operation.  If the upload fails, you've
not got rubbish in your DB that you need to clear up.

>   The Upload Panel would "finish" when the file finishes upload.
>
> Is this possible?

Without client side component support the only way to upload a file is via a
Form post from the browser.  Unfortunately Form posts were never intended to
carry large amounts of data and therefore no thought has been given to
providing the user with progress info on the upload.

If you're desperate then you might get away with performing the Form post
from a page in an IFrame,  you could have a progress bar in the host page
polling the server and retrieving the size of the temporary file.  I'm not
entirely sure how you would retrieve the expected final size of the file
though (I'm not familiar with the file upload control where you might expect
to get that info, I use a client side component instead).

Signature

Anthony Jones - MVP ASP/ASP.NET

Jevon - 12 Feb 2008 10:52 GMT
I've previously come across (but not yet used)
http://www.brettle.com/neatupload - have you seen this yet? I have no idea
if it can be used with an UpdatePanel, but I think it does the other stuff
you mention.

I agree with Anthony though, ideally you shouldn't be updating anything in
the database until you have the file on the server to work with.

Jevon

> Hello,
>
[quoted text clipped - 23 lines]
>
> Miguel
Ilyas - 12 Feb 2008 14:10 GMT
> I've previously come across (but not yet used)http://www.brettle.com/neatupload- have you seen this yet? I have no idea
> if it can be used with an UpdatePanel, but I think it does the other stuff
[quoted text clipped - 34 lines]
>
> - Show quoted text -

Telerik have a file upload control which can do exactly this
See http://www.telerik.com/products/aspnet/controls/upload/overview.aspx

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.