Click or drag to resize
UploadedFileSaveAs Method (String, Boolean)
Saves the contents of an uploaded file.

Namespace: Kettic.AspNet.Controls
Assembly: 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
)

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++)
{
    // Create a new file name.
    TempFileName = "C:\\TempFiles\\File_" + Loop1.ToString();
    // Save the file.
    MyFileCollection[Loop1].SaveAs(TempFileName, ShouldOverwrite);
}
See Also