Occurs when server EditorControl receives a document from the client.
Event Data
The event handler receives an argument of type DocumentEventArgs containing data related to this event. The following DocumentEventArgs property provides information specific to this event.
| Property | Description |
|---|
| Param | Gets or sets a custom string parameter passed to/from the client. |
Remarks
The server page must implement this event handler in order to be able to receive documents from the client. Inside the event handler, use the GetDocument method to retrieve the document as a stream.
If you do not implement this event handler, the client will receive an HTTP error in response.
Example
Shows possible implementation of DocumentReceived event handler. Document is received and converted into the DOC file.
[C#]
private void OnDocumentReceived(object sender, DocumentEventArgs e)
{
// Passed param value is treated as file name, here we map it to server path
string fileName = MapPath("Documents\\" + e.Param);
// Get document as DOC file stream
FileStream stream = File.Create(fileName);
e.GetDocument(stream, DocumentFormat.Doc);
stream.Close();
}
[Visual Basic]
Private Sub OnDocumentReceived(ByVal sender As Object, ByVal e As DocumentEventArgs)
' Passed param value is treated as file name, here we map it to server path
Dim fileName As String = MapPath("Documents\" & e.Param)
' Get document as DOC file stream
Dim stream As FileStream = File.Create(fileName)
e.GetDocument(stream, DocumentFormat.Doc)
stream.Close()
End SubSee Also
EditorControl Class | Aspose.Editor.Server Namespace