Gets the current stored file path.
Namespace:
EasyAlgo.EAUploadAssembly: EasyAlgo.EAUpload (in EasyAlgo.EAUpload.dll)
Version: 1.3.0.0
Syntax
| C# |
|---|
public string StoredFileName { get; } |
| Visual Basic (Declaration) |
|---|
Public ReadOnly Property StoredFileName As String |
Field Value
Type: System..::.StringThe uploaded file path on the server.
Remarks
By default, this property returns a path to the temporary file. After calling the SaveAs(String) method, property returns a path to the saved file.
Examples
The following code example demonstrates how property StoredFileName is changing depends on SaveAs(String) method call.
CopyC#
CopyVB.NET
// UploadFile.aspx.cs ... // Lable control that is defined on .aspx page lblResponse.Text = ""; Upload _upload = UploadsManager.GetUpload(); // Define directory to which an uploaded files will be stored. string SaveFolder = Server.MapPath("") + "\\UploadedFiles\\"; if (_upload != null && _upload.Status.State == UploadState.Complete) { // Iterate through uploaded files collection. for (int i = 0; i < _upload.UploadedFiles.Count; i++) { UploadedFile _file = _upload.UploadedFiles[i]; // The name of uploaded file before SaveAs method first call equal to the name of the temporary file. lblResponse.Text += "File name before SaveAs method call was: " + _file.StoredFileName + "<br />"; // Save an uploaded file to a specific location // with name that was been on the client's machine. // You can save an uploaded file with any name. // To do that, just specify the required name in "path" parameter of SaveAs method. // Here we guessed that the QualifiedFileName property is "contract.pdf" _file.SaveAs(SaveFolder + _file.QualifiedFileName, true); // The name of uploaded file after SaveAs method call equal // to the name that is specified in path parameter of the SaveAs method. lblResponse.Text += "File name after SaveAs method call is: " + _file.StoredFileName + "<br />"; } } ... // The following approximate result we will see on the page File name before SaveAs method call was: c:\Temp\waiu459ds2j42h4k2242424453kjerg.tmp File name after SaveAs method call is: c:\Inetpub\wwwroot\EAUploadExample\UploadedFiles\contract.pdf ...
' UploadFile.aspx.vb ... ' Lable control that is defined on .aspx page lblResponse.Text = "" Dim _upload As Upload = UploadsManager.GetUpload ' Define directory to which an uploaded files will be stored. Dim SaveFolder As String = Server.MapPath("") & "\UploadedFiles\" If ((Not _upload Is Nothing) AndAlso (_upload.Status.State = UploadState.Complete)) Then Dim i As Integer ' Iterate through uploaded files collection. For i = 0 To _upload.UploadedFiles.Count - 1 Dim _file As UploadedFile = _upload.UploadedFiles.Item(i) ' The name of uploaded file before SaveAs method first call equal to the name of the temporary file. lblResponse.Text &= "File name before SaveAs method call was: " & _file.StoredFileName & "<br />"; ' Save an uploaded file to a specific location ' with name that was been on the client's machine. ' You can save an uploaded file with any name. ' To do that, just specify the required name in "path" parameter of SaveAs method. ' Here we guessed that the QualifiedFileName property is "contract.pdf" _file.SaveAs(SaveFolder & _file.QualifiedFileName, True) ' The name of uploaded file after SaveAs method call equal ' to the name that is specified in path parameter of the SaveAs method. lblResponse.Text &= "File name after SaveAs method call is: " & _file.StoredFileName & "<br />"; Next i End If ... ' The following approximate result we will see on the page File name before SaveAs method call was: c:\Temp\waiu459ds2j42h4k2242424453kjerg.tmp File name after SaveAs method call is: c:\Inetpub\wwwroot\EAUploadExample\UploadedFiles\contract.pdf ...
