CHAN Reference
Chan Home | Reference Home | Event Firing Order | web.config
Controls.Upload
- Name Upload
- CSS Class CC_Upload
- Type (file)
The upload control simplifies the code-behind needed to handle input[type:file] controls by allowing you to specify valid file extensions and by taking care of the binary transport and file handling. It saves Uploaded files under the [Chan_Temp_Dir] directory in randomly named subfolders to prevent collisions.
It holds an internal public Enum type of UploadState and exposes its current state via a State property, you can use this to drive your codebehind by checking that a file exists of the correct type. The control also maintains its state across postbacks, remembering the most recent file uploaded using that instance and allowing the user to change their selection at any time if they wish by providing a Change button.
Roadmap
- Add a FileName property that both allows you to read the current filename (without any Path) and allows you to set it when, for example, editing a database entry with an attachment or image. This will need a new UploadState state that will be set by the FileName setter, such as UploadState.ExistingFile.
- Clean up of internal code logic and better auto-clean of Temp_Dir, perhaps adding a CleanAll() function that flushes any temp upload older than 12 hours from the temp dir.
- Move UploadSate into root Chan namespace alongside ConfigBool (for example)