UploadedFile.SaveAs(String) Method
Saves the uploaded file specifying the full path on the server.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
file |
String | A String value that specifies the full path to the location on the server to save the uploaded file. |
#Remarks
Uploading a file specified on the client can be initiated either by the client ASPxClientUploadControl.Upload method, using the upload button or automatically, on the next round trip to the server. The SaveAs method can be used to save the uploaded file to a specific location on the server. Typically, the SaveAs method is called within the ASPxUploadControl.FileUploadComplete event’s handler. Before calling the SaveAs method, it is recommended to test the FileUploadCompleteEventArgs.IsValid property, to verify whether the uploaded file passes the validation criteria if any have been defined via the ASPxUploadControl.ValidationSettings property or specific custom code.
The SaveAs method’s parameter value represents the full path on the server where the uploaded file should be saved. This path can either be absolute (for instance, “C:/Documents/Image.jpg”) or relative to the web application folder (by using the MapPath method). When composing the saved file’s path, you can define any custom name for the file or use the name obtained by the UploadedFile.FileName property.
Note
To be able to save the uploaded file, the ASP.
Important
The Save
Important
To use the Save
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveAs(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.