Code for .Net File Uploader/Downloader with backend SQL storage.
Probably one of the most popular controls that are talked about on web forums and available from third parties are file upload controls. I have found however there is a lack of information and code for people who want to manage those files once they get to the server.
Since I have recently been doing a lot of work with secure workflow in .Net I have needed to use this functionality, so I have created a sample project showing what I have done. The sample project performs the following functions:
- Multiple file upload on the client (similar to gmail’s file upload facility)
- Storage of uploaded files in SQL Server.
- Display of existing uploaded files with associated icons and file size information.
- Ability to add and remove file attachments from an existing record.
- Download and display the uploaded files.
The zipped C# vs2005 solution can be downloaded here .
You will need to create a new SQL Database and run the sql code in the DBSetup Folder of the Project to create the required database tables and stored procs. You may also need to setup the security for these SQL elements depending on how you have your test environment setup. You will then need to adjust the AttachmentDatabase connection string in the web.config to match your settings.
I have used Typed Datasets through a Data Layer. I have included all of the DataSets and Data Link layer in the Web Project. Usually I would separate these out into their own projects, but for this sample I haven’t done that.
Some screen shots of it in action are below.
A record with various types of files attached.
Adding more files to an existing record.
A blank record.
1 Comments:
hii there...
I appreciate ur efforts n i wud be grateful to u if u could post some more details abt da project coz it showed error while uploading the files....
By Anonymous, at 12:14 am, February 13, 2008
Post a Comment
<< Home