How to access/read from uploaded file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to access/read from uploaded file

    I've looked at this example and I don't understand how the FileUploadField works. The "filepath" is just the name of the file, which doesn't seem all that helpful to me. How are you supposed to be able to access the file or do anything with it?

    Eventually I would like to read from a spreadsheet, but could I get an example of reading an uploaded text file? Here is what I have to start:

    View:
    viewportItems.Add(Html.X().Window()
        .ID("UploadWindow")
        .Layout("AutoLayout")
            .Items(items =>
            {
                items.Add(Html.X().DisplayField()
                    .Text("Choose the file you would like to upload:"));
                items.Add(Html.X().FileUploadField()
                    .ID("FileUploadField"));
            })
            .Buttons(button =>
            {
                button.Add(Html.X().Button()
                    .ID("UploadButton")
                    .Text("Upload")
                    .DirectEvents(directEvent => {
                        directEvent.Click.Url = "~/Home/UploadFile";
                        directEvent.Click.CleanRequest = true;
                        directEvent.Click.Method = HttpMethod.POST;
                        directEvent.Click.ExtraParams.Add(new Parameter("fileLocation", "this.up('window').down('fileuploadfield').getValue()", ParameterMode.Raw));
                         }));
            }));
    Controller:
    public ActionResult UploadFile(string fileLocation)
    {
        //How to read from file?
    }
    Last edited by KBorkiewicz; Nov 20, 2012 at 9:52 PM.

Similar Threads

  1. File uploader with the list of uploaded files
    By AlexMaslakov in forum 1.x Help
    Replies: 0
    Last Post: Aug 11, 2011, 11:56 AM
  2. [CLOSED] How to clear the uploaded file from fileuploadfield
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 21, 2011, 6:52 PM
  3. Replies: 0
    Last Post: Mar 31, 2010, 3:34 AM
  4. Controls Dont Dispaly Once Uploaded To Server
    By b.aytes in forum 1.x Help
    Replies: 8
    Last Post: Jul 29, 2009, 10:04 AM
  5. [CLOSED] AjaxRequestModule stopping normal file access
    By Steve in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Apr 17, 2009, 6:11 AM

Tags for this Thread

Posting Permissions