Actually i have created one page with text and image saving process to database. So i have used form-data. Everything is fine but when we give text with spaces, the spaces changed to '+' symbol. Please find below code for how i tried,
Script :
var fileData = new FormData();
var notes = "testing testing testing testing testing testing testing te";
fileData.append('notes', notes);
$.ajax({
url: "api/update",
type: "POST",
data: fileData,
},
success: function (response) {
alert("saved");
}
});
I can get same string while debug Script. But after we posted from script to Action only i can get string as "testing+testing+testing+testing+testing+testing+testing+test".
C# :
[HttpPost]
[Route("api/update")]
public async Task<dynamic> PostAsyncOccupantImage()
{
string error = string.Empty;
MyStreamProvider streamProvider = new MyStreamProvider();
await Request.Content.ReadAsMultipartAsync(streamProvider);
var notes = streamProvider.FormData.ToString().Split('&')[0]
return error;
}
Please give your suggestion. Thanks, Arun D