HttpPostedFile::SaveAs Method (String^)

 

Saves the contents of an uploaded file.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public:
void SaveAs(
	String^ filename
)

Parameters

filename
Type: System::String^

The name of the saved file.

Exception Condition
HttpException

The RequireRootedSaveAsPath property of the HttpRuntimeSection object is set to true, but filename is not an absolute path.

The maximum size allowed for a request, which includes uploaded files, is 4 MB, by default. Maximum request size can be specified in the Machine.config or Web.config file in the maxRequestLength attribute of the httpRuntime Element (ASP.NET Settings Schema) element. The maximum request size for a specific page can be specified using the location Element (ASP.NET Settings Schema) element in a Web.config file.

The following code example demonstrates how to save all the files that are uploaded by the client to the C:\TempFiles folder on the Web server's local disk.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: