I am attempting to post form data to the server. This form is in the backoffice in a custom section, on a custom dashboard. The form data contains a file to upload. I am not having any luck here. If someone can point me in the right direction, that would be great.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Umbraco.Web.WebApi;
using Umbraco.Web.Editors;
using Umbraco.Core.Persistence;
using System.Web.Script.Serialization;
using Bridge.Models;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
namespace My.Controllers
{
public class NewSubFormData
{
public string title { get; set; }
public DateTime postDate { get; set; }
public HttpPostedFileBase file { get; set; }
public bool active { get; set; }
public bool notify { get; set; }
}
[Umbraco.Web.Mvc.PluginController("My")]
public class SubscriptionsAPIController : UmbracoAuthorizedApiController
{
public string SaveSub(NewSubFormData newSub)
{
return "Success";
}
}
}
When I click "submit", I get the following errors:
"The request entity's media type 'text/plain' is not supported for
this resource."
No MediaTypeFormatter is available to read an object of type
'NewSubFormData' from content with media type 'text/plain'
Posting data to server
I am attempting to post form data to the server. This form is in the backoffice in a custom section, on a custom dashboard. The form data contains a file to upload. I am not having any luck here. If someone can point me in the right direction, that would be great.
HTML:
controller:
Resource:
Server-side API controller:
When I click "submit", I get the following errors:
check out the post below for some pointers
https://our.umbraco.com/forum/using-umbraco-and-getting-started/105440-umbraco-8-backoffice-upload-a-file-angular
is working on a reply...