1

On GitHub they have asp.net mvc demo. Not full project but controller/class/binder.

I downloaded their code, there is test folder with no dependency demo and jquery demo.

I also made my controller/action as on their demo.

 public partial class UploadController : MyController
{
        [HttpPost]
        public ActionResult UploadFile(FineUpload upload, string extraParam1, int extraParam2)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader

            var dir = @"e:\temp\";
            var filePath = Path.Combine(dir, upload.Filename);
            try
            {
                upload.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                return new FineUploaderResult(false, error: ex.Message);
            }

            // the anonymous object in the result below will be convert to json and set back to the browser
            return new FineUploaderResult(true, new { extraInformation = 12345 });
        }
}

On their test demo page, i change endpoint parameter to

 endpoint: "http://localhost:60784/upload/uploadfile"

But heh, how i get exception like

A public action method 'uploadfile' was not found on controller     'MaNameSpace.Controllers.UploadController'.
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
Novkovski Stevo Bato
  • 1,013
  • 1
  • 23
  • 56

1 Answers1

1

There are two things you can do:

  1. Try adding a last slash to the endpoint URL: http://localhost:60784/upload/uploadfile/

  2. Change [HttpPost] to [HttpGet] and see if the action method gets hit.

Using Firebug on Firefox open at the Network tab, you can take a look at the request that's being made to the server and check if the File Upload plugin is issuing a Get or Post request.

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
  • Heh now u total confuse me. Changing to [HttpGet] calls my action. On Chrome inspect element network request type is "OPTIONS" http://prntscr.com/sm6xx and since its not "POST" my ImputStream is always null/empty http://prntscr.com/sm71s – Novkovski Stevo Bato Feb 13 '13 at 18:26
  • uhmmm... So you can do what's described here: http://stackoverflow.com/a/2008013/114029 or remove the `AcceptVerb` from the action method as described here: http://stackoverflow.com/a/9932926/114029 – Leniel Maccaferri Feb 13 '13 at 18:27
  • If the above doesn't work, check this: http://stackoverflow.com/q/14333621/114029 – Leniel Maccaferri Feb 13 '13 at 18:34