Additional Fields Sample
Select files to upload:
remove [x]
Name:
Category:
Description:
|
Uploading ,
(calculating).
|
|
Currently uploading:
,
file
of
.
|
|
Speed:
(calculating).
|
|
About
(calculating) remaining.
|
|
|
Cancel
NOTE: the maximum allowed request size for this sample is 1000 MB. If you attempt to upload files larger than this,
you will recieve a oversized upload error which SlickUpload will handle gracefully. This is controlled by the maxRequestLength attribute of the
httpRuntime key in the web.config file.
Description
This sample demonstrates how to add additional form elements for each file, and then read out the values that are entered. To add form elements, simply add any form element (input, select, etc.) to the <FileTemplate> template.
Give them a unique name (this is how you will read them back after an upload). For this example, the template is as follows:
<kw:FileListRemoveLink runat="server" Title="Remove">
[x]
</kw:FileListRemoveLink>
<kw:FileListFileName runat="server" />
<kw:FileListValidationMessage runat="server" ForeColor="Red" />
<br />
Name: <input type="text" name="name" />
Category:
<select name="category">
<option value="Public">Public</option>
<option value="Private">Private</option>
<option value="All">All</option>
</select>
<br />
Description:<br />
<textarea name="description" rows="5" cols="50"></textarea>
Notice the additional input elements at the end of the template. This adds three additional elements to each file item:
- An <input> named "name"
- An <select> named "category"
- A <textarea> named "description"
SlickUpload takes care of templating and managing the names for each element as the files are selected and uploaded. After an upload, you can access the values that were posted
for each file via the UploadedFile.FormValues dictionary. So, for this example, given an UploadedFile named "file", you could write the following code in the UploadComplete event
to read back the form values that were posted for that file:
string name = file.FormValues["name"];
string category = file.FormValues["category"];
string description = file.FormValues["description"];
|