I am developing an asp.net application using .NET 4.0
I have a total of 5 fileupload controls in my page.
What I want to do is, as soon as I click on… lets say… ‘add file’, the added file should be visible at a section of the page in the following format:
FileName Attached By Attached Date
When the user clicks on the filelink he should be able to download/preview it.
The files gets saved to the database (I am using sql2008) ONLY after the form is finally submitted and not on click of ‘add file’
So as I add more files, the rows with the correct data should be added to the table/grid….
Is there any way of doing this without causing a postback or a DB hit? Code samples will be much appreciated 🙂
This is possible, but only with File API in HTML5
http://www.html5rocks.com/en/tutorials/file/dndfiles/
This is one File Upload plugin with preview using FileReader API
http://blueimp.github.com/jQuery-File-Upload/
See the documentation for using with .NET
EDIT:
If you need a solution without using FileReader, you will have to depend on uploading.
You can do as given below:
Step1. User adds a file
Step2. File is uploaded temporarily and content is returned to browser and shown as preview.
Step3. If user accepts the file is added to database and saved permanently
Step4. If user rejects the temporary file is deleted from server.