WordPress.org

Ready to get started?Download WordPress

Forums

Run php script from theme backend (3 posts)

  1. alexmoba
    Member
    Posted 4 years ago #

    Hello, I'm currently developing a theme witch has a rather powerful backend, I created a php image upload box that runs perfectly if accessed by the direct url, example:

    http://www.example.com/wp-content/themes/example-theme/library/functions/image-upload.php

    However I want to integrate the form in image-upload.php to my theme backend, naturally my first attempt was to use a simple include:

    <?php include ('image-upload.php'); ?>

    And the form did get embedded in my theme backend but it just doesn't work, it does not upload an image to my server, however by accessing the image-upload.php directly by url it does work (as mentioned above).

    Does anyone have an idea why this happens?

  2. Dagon Design
    Member
    Posted 4 years ago #

    Does it act like it is going to upload, but stop? Does it give an error?

    Perhaps it is giving an error/warning, but not showing it. You could add this to the top of the file:

    error_reporting(E_ALL);

  3. alexmoba
    Member
    Posted 4 years ago #

    I tried the error_reporting function however there doesn't seem to be any problems with hidden errors.

    As an alternative I've just added a link to the direct php script inside the theme backend and it works just fine, the problem is when I included the form in the backend.

    Although they're both on the same folder I have a feeling the relative paths are different when including the php script and when accessing it directly.

Topic Closed

This topic has been closed to new replies.

About this Topic