UploadedFileSaveAs Method (String, Boolean) |
Saves the contents of an uploaded file.
Namespace: Kettic.AspNet.ControlsAssembly: Kettic.AspNet.Controls (in Kettic.AspNet.Controls.dll) Version: 2014.4.1129.0 (2014.04.1129.0)
Syntax public abstract void SaveAs(
string fileName,
bool overwrite
)
Public MustOverride Sub SaveAs (
fileName As String,
overwrite As Boolean
)
public:
virtual void SaveAs(
String^ fileName,
bool overwrite
) abstract
abstract SaveAs :
fileName : string *
overwrite : bool -> unit
Parameters
- fileName
- Type: SystemString
The name of the saved file. - overwrite
- Type: SystemBoolean
true to allow an existing file to be overwritten; otherwise, false.
Remarks The maximum allowed uploaded file size is 4MB by default. Maximum file size
can be specified in the machine.config or Web.config configuration files in the
maxRequestLength attribute of the <httpRuntime> element.
The ASP.NET process must have proper rights for writing on the folder where
the files are saved.
Examples
The following example saves all the files uploaded by the client to a folder named
"C:\TempFiles" on the Web server's local disk. The existing files are overwritten.
String TempFileName;
bool ShouldOverwrite = true;
UploadedFileCollection MyFileCollection = KaxUpload1.UploadedFiles;
for (int Loop1 = 0; Loop1 < MyFileCollection.Count; Loop1++)
{
TempFileName = "C:\\TempFiles\\File_" + Loop1.ToString();
MyFileCollection[Loop1].SaveAs(TempFileName, ShouldOverwrite);
}
Dim Loop1 As Integer
Dim TempFileName As String
Dim ShouldOverwrite As Boolean = True
Dim MyFileCollection As UploadedFileCollection = KaxUpload1.UploadedFiles
For Loop1 = 0 To MyFileCollection.Count - 1
TempFileName = "C:\TempFiles\File_" & CStr(Loop1)
MyFileCollection(Loop1).SaveAs(TempFileName, ShouldOverwrite)
Next Loop1
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also