Fileupload in Episerver cms 6


Now I have got a question from my customer if there is an easy way to create a registrationform from which the enduser can upload multiple files? The form enduser should be able to enter name and some other information, in addition to uploading files from their PC. In addition there should be an restriction to the files being uploaded (fileextenxions, size of the file etc). 

My question is: How can I do this in CMS 6?

Sep 23, 2013 10:37

If you would like it to be a part of Xforms, Anders Hattestad presents this solution:

Not very easy, but fully possible :)

Once the form is submitted, you can create a HttpPostedFile-object of the posted file, and find a lot of interesting information :) It's all shown in Anders example above.


Good luck!

Sep 23, 2013 11:22

It my come handy, however you will have to come up with something for uploading multiple files at a time. Search for jQuery multiple-file upload plugin.

Sep 23, 2013 22:21

Hi, thanks for your replies! I am pretty new to uploading files and XFOrms in general. Do I have to make an XForm to get this to work?

Sep 24, 2013 14:22

Yes you do, you have to create page type that contains property of type XForm and then you can design your form structure and save it in XForm repository and select it as form to be used in that page. If you need more info on XForms I recommend to lookup section in developer guide.

Sep 24, 2013 15:13

Well, if the customer have a need for creating several forms with this functionality, then XForms is the way to go. BUT, if it's a static form then I would personally stay away from using XForms and just create a page type or a dynamic content with the form. 

Sep 24, 2013 15:20

The customer needs a form that contains several inputfields, some dropdownlists, and the fileupload. Choises done in the dropdownlists is the basis of other drop down lists.

When the end user pushes the "Save" button, all fields are saved and the files should be saved on the server as well.

What is the best way to implement this? I am dembted to do this without XForm if that will be possible ;)

Sep 25, 2013 12:43

According to requirements I would go with simple form, dynamic content + form to accomplish this. XForm are not really a good subject for customization, extensions. Changing dropdown values depending on other values are pretty easy achievable using client side scripting. In this case XForm infrastructure may give you a nice looking dashboard gadget to overview submitted data otherwise - I would go for a simplest solution and advance it later if needed.

Sep 25, 2013 13:08

One more question. Why do you want to create a dynamic content? what do you actually meen by that?

Sep 25, 2013 14:30

We usually use dynamic content to decrease the amount of page types needed. Dynamic content can be inserted anywhere were you have the TinyMCE-editor. See this blog post:

When it comes to storing the Form-data, you can actually use XForms functionality without using XForms as the actual form (confusing? :)). See:

Or you can just use Dynamic Data Store:

Sep 25, 2013 14:35

Thank you for your description Erik. I think I go for the Dynamic content and then using the Dynamic Data Store :) I will let you know if I run into trouble ;)

Sep 26, 2013 12:44
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.