This is a migrated thread and some comments may be shown as answers.

Passing an array

0 Answers 60 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Hugo
Top achievements
Rank 1
Hugo asked on 01 Nov 2012, 06:24 PM
Hi, 

I want to pass an array to the controller in MVC3 using the upload widget from kendo, here my code : 

        $("#uploadFiles").kendoUpload({
            showFileList: false,
            localization: {
                "select": "Browse new"
            },
            select: SelectionCompleted,            
            async: {
                autoUpload: false,
                saveUrl: "/MediaManager/UploadFile/"
            },            
            upload: function (e) {                
                var files = [
                    {
                        Title: 'Test',
                        FileName: 'MyFile',
                        Group: 'MyGroup',
                        Color: 'MyColor'
                    },
                    {
                        Title: 'Test2',
                        FileName: 'MyFile2',
                        Group: 'MyGroup2',
                        Color: 'MyColor2'
                    }
                ];
                e.data = { files: files };
            }
        });

And here my  model related to this JSON object : 

    public class FileUpload
    {
        public string Title { get; set; }
        public string FileName { get; set; }
        public string Group { get; set; }
        public string Color { get; set; }
    }    

And here my code in the controller : 

public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> uploadFiles, IEnumerable<FileUpload> files) {}

The problem the array is empty.... What I'm doing wrong ?

Thank you

No answers yet. Maybe you can help?

Tags
Upload
Asked by
Hugo
Top achievements
Rank 1
Share this question
or