EdgeDoc
Features
Tech Specs
How-to C#
Pricing
Upload a File to the Viewer
  |  
Home ›› XDoc.HTML5 Viewer ›› C# Viewer: Upload a File to Viewer

C# HTML5 Viewer: Upload a File to Web Viewer


How to Upload a File to Your HTML5 Document Viewer for Viewing in C#






If you've already created a document viewer in your C# application, you may now upload a file to view and process on the viewer. A simple .NET API can help you to achieve this, which is CreateWebDocFromUpload(HttpRequest request);. By using this API, you can easily create a REWebDocument object that include all information of parsed document.




How to Add File Uploading Feature in Your Viewer



In order to add file uploading feature to your HTML5 document viewer in C# application, you need to use the following code in Default.aspx.




var _tabFile = new ToolbarTab(File);
_tabFile.addCommand(new RECommand(upload));
_viewerTopToolbar.addTab(_tabFile);




In addition, in your Default.aspx.cs, you should add the code below. Here, .NET API CreateWebDocFromUpload(HttpRequest request); is used.




private void RequestServerceHandler()
{
        string command = Request.Form["RECommand"];
        if (command == null || command.Equals(""))
        {
                if (Request.Files.Count > 0)
                LoadFileFromUpload();
        }
}

public void LoadFileFromUpload()
{
        REWebDocument webDoc = REDocumentControl.CreateWebDocFromUpload(Request);
        REDocumentControl.ResponseToClient(webDoc.MsgToClient, Response);
}