Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:16:58+00:00 2026-06-08T10:16:58+00:00

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

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:17:01+00:00Added an answer on June 8, 2026 at 10:17 am

    First off I’m not going to attempt to pretend that I know ASP.NET well. So with that, based on my glance over the code you provided. It actually looks like it could be type of language, doesn’t appear to me at the least eccentric to any given scripting type. Looks like Object Oriented code to me. But thats a mute point.

    Overall what the code appears to be doing is, instantiating another class which I would assume is the bulk of the code you’d much rather look at. But from this little snip its using the class to validate if the file is found, and is indeed an image in this case. If it is, then give a URL base on its location on the server. If not give an error. It also appears that its outputting in JSON format so a JavaScript can pick it up and use it, in example an AJAX request.

    That said, there a means via PHP to verify if the file is on your server with
    http://php.net/manual/en/function.file-exists.php

    then depending on what version of PHP your running you could use
    http://php.net/manual/en/function.finfo-file.php (if newer php version)
    or
    http://php.net/manual/en/function.mime-content-type.php (older php version)

    to get the file type, where there you would do a similar if-else with php based on those, that you provided in the ASP snipplet. You would output a json_encoded array for valid or good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading this tutorial from the DNN website http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/2675/DotNetNuke-Skinning-101-Part-2.aspx I found the tutorial
I was reading up on this javascript tutorial: http://www.switchonthecode.com/tutor...ccordion-menus Basically, it shows you how
I'm new to iOS programming and I'm reading this tutorial to get along http://www.raywenderlich.com/1797/how-to-create-a-simple-iphone-app-tutorial-part-1
I am reading this tutorial : http://sleekd.com/general/adding-multiple-images-to-a-rails-model-with-paperclip/ because i need Save the product images
i am reading this page http://www.cplusplus.com/doc/tutorial/exceptions.html it says if i write function() throw(); no
I am reading this tutorial http://developer.android.com/guide/google/play/billing/billing_testing.html and it is really confusing me :) In
I'm reading this section of Java EE tutorial. http://download.oracle.com/javaee/6/tutorial/doc/bncfu.html#bncfy And have a question: If
I started reading this tutorial: http://active.tutsplus.com/tutorials/actionscript/creating-a-reusable-flash-uploader-with-actionscript-3-0-and-php/ I'm using FlashDevelop, and I pasted the full
I was just reading this article: http://www.tutorialized.com/view/tutorial/Spring-MVC-Application-Architecture/11986 which I find great. It explains the
Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.