(up) Execute standalone multiple files upload with auto email option. Entire applicatoin in (2) lines.
Namespace:
TornadoAssembly: Tornado (in Tornado.dll) Version: 12.6.0.9 (1.0.0.0)
Syntax
| C# |
|---|
public string dbUpload { set; } |
| Visual Basic (Declaration) |
|---|
Public WriteOnly Property dbUpload As String |
Field Value
Object.dbUpload = "Files| Label | Width| SavePath| SaveAs| Overwrite| AllowExt| AllowSize| Notes| SysMessage| Attach| UploadButton"Dim GD As New Tornado.Getdata()
Dim uf As String() = GD.Get_UploadFiles
Obj.dbMail = "From |To |Subject |SMTPserver (mini version)- ASPdbupload supports auto email. if Obj.dbMail is defined.
- This is a mini version of dbMail - DB macros are not supported. A pre-defined body same as the report shown at the browser minus the SavePath info.
- Auto Email activates only if uploaded files > 0.
| Keyword | Description |
|---|---|
| Files | How many files to upload (blanks will be ignored). Each file will occupy a row. Def=3 Inputs |
| Label | Label macro of each row followed by the row number. [#] will be replaced by 1,2,3.... etc. Def="Upload File #" |
| Width | Width of the Browse Input Box. Def=45 |
| SavePath | Virtual or physical path save path.
This parameter will be converted to the physical directory where files are saved.
Warning: This directory path must have ASPNET write privilege like the /Tornado/Scratch directory. *** This is the only mandatory parameter *** |
| SaveAs | Save filename macro to avoid conflict (Def=#). "#" will be replaced by the original filename. You can add to filename part or extension part of filename. Normally use session.sessionid as a prefix to make the upload filename unique. |
| Overwrite | True(Def) | False - Allow overwrite of old files. |
| AllowExt | Allow Extension of upload files separated by a [.] period. [*] allows all extensions.
Def=jpg.jpe.jpeg.gif.png.txt.Doc.xls.ppt.pdf. |
| AllowSize | Max allowable size of upload file (avoid server attack). Def=1 MB. |
| Notes | Display on line upload restriction notes. Def=True |
| Message | Add a message box after Upload button ot the Notes box. |
| Attach | Attach all uploaded file to the Auto Email in the To: format of add1;add2;.... Def=False |
| UploadButton | Full path of Upload Image button or use system button path if no "/" in filename. Def=System Upload button. |
| SysMessage | Suppress system message output. Def=True |
| Get_UpoloadFiles | Returns a string array of the uploaded file names. |
Remarks
- Auto Email after upload action is supported.
- Uploaded file names are exported for retrieval in a string array format.
- Uploading Large Files -
- Read MS KB295626 (Cannot Upload Large Files When You Use the HtmlInputFile Server Control)
- When you try to use the HtmlInputFile control to upload a large file, the file may not be uploaded.
- Resolution #1 - In the Machine.config file, change the maxRequestLength attribute of the <httpRuntime> configuration section to a larger value. This change affects the whole computer.
- Resolution #2 - In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded: <httpRuntime maxRequestLength="8192" />
- This value is restricted to 4 MB by default to restrict possible Denial of Service attacks.
- The maximum possible size is 2 gigabytes (GB).
Examples
<script language="VB" runat="server"> Sub Page_Load(Src As Object, E As EventArgs) Dim GD As New Tornado.GetData Dim up As New Tornado.z up.dbQP = "U=1|S=5|Th=Ti=Upload Demo" up.dbUpload = "SavePath=/tornado/scratch/" '...Send Email Notification to this address(es) upon Upload files > 0 up.dbMail = "From=Me@aspdb.com | Subject=Upload Grid Report | SMTP=email_server| To=addr_1;_addr_2" up.ASPdbUpload() Dim uf As String() = GD.Get_UploadFiles If Not IsNothing(uf) Then Dim i As Integer For i = 0 To UBound(uf) Response.Write(uf(i) & "<br>") Next End If End Sub </script>