I was reading this tutorial.
http://ben.onfabrik.com/posts/pagedown-markdown-editor-custom-image-dialog
At the end of it there is ASP.NET code
[HttpPost]
public ActionResult EditorUpload(MediaEditorUploadModel model)
{
string result;
var serializer = new JavaScriptSerializer();
if (model.File.IsValidFile() && model.File.IsImage()) {
// upload the file
result = serializer.Serialize(
new { success = true, imagePath = "http://{the url of the uploaded image}"});
} else {
result = serializer.Serialize(
new { success = false, message = "Invalid image file"});
}
return Content(result); // IMPORTANT to return as HTML
}
But I have no idea, How I must respond it in PHP. Can anyone help me to translate this code into PHP?