I'm trying to post the content of an image element to my controller so I can store it in my database with the use of an element.
The image src format is something like this:
data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAMUAAAEACAYAAAADarJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAFCxJREFUeJzt3XuUnHV9x/HP9zuzu0kAEUKicqyGGsAbF41ELAm7syG7swmCye5ka22otF6rYqmKp3houng5R9GDtl4OwvFCC6e72QkihMwmZGc3IWop0SqXQ2qUtV6qyQZSkkAu83y//SM7usRNMjPP73l+z8x+X39yTr7PN+R57zO3fQYwxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMYlGvheYLhbctqDp1DNeMhspOosomE2qpxNRSxCghYFmENJQlJRxiAmHVfUQNLUXGuyh5u
Here is my javascript:
$("#submit").click(function () {
var data = new FormData();
data.append("image", $('#myImage').attr.src);
$.ajax({
url: "/default/upload/",
type: "POST",
processData: false,
contentType: false,
data: data,
success: function (response) {
//code after success
alert("succes");
},
error: function (er) {
alert(er);
}
});
and here is my controller method:
[HttpPost]
public void Upload(string image)
{
Console.WriteLine("Do Something");
}
My breakpoint is triggered but my image string just contains undefined