Search code examples
c#umbracoumbraco8

Cannot save content with an empty name on content save at controller level in Umbraco 8


I am getting this error on saving and Publish "Cannot save content with an empty name" at controller level in Umbraco 8 I have a simple method in surface controller after form submit, which has a file upload and name and email, but after save and publish, I get this error that "Cannot save content with an empty name"

IContentService contentService = Services.ContentService;
var content = contentService.CreateContent("samplename", udi, sample.ModelTypeAlias);
content.SetValue("entry", model.FileUpload);

 contentService.SaveAndPublish(content);

Before this it worked fine in umbraco 7 for me.


Solution

  • So for anyone facing the same issue, the answer i found was to set the culture if u have multi cultures enabled for your site

    contentService.SaveAndPublish(content, "en-US");