Jump to content

500 internal server error in backend fields setup page


Recommended Posts

Hi all,

I got a Internal Server Error when accessing de /setup/fields in my back end...
Also when i try to reach it through the page tree, i can't edit the 'fields' page, same error.

I do modify a image field through the api, i don't know if that has something to do with it, below the code i use to upload an image through the api, I deleted the parts that are not important. If anyone can help me that would be great.

To clarify; the code below works fine, my image and page is created as expected, the only thing is that I can't access my /setup/fields/ page in my CMS anymore due to the Internal Server Error.

        if($input->post->submit) {

            $photoPage = new Page(); // create new page object
            $photoPage->template = 'photo'; // set template
            $photoPage->parent     = wire('pages')->get('/foto/'); // set the parent
            $photoPage->name     = urlBuilder($input->title_photo); // give it a name used in the url for the page
            $photoPage->title     = $input->title_photo; // set page title (not neccessary but recommended)
            // next: process photo upload
            // Set a temporary upload location where the submitted files are stored during form processing
            $upload_path = $config->paths->assets . "files/photos/";
            // New wire upload
            $file_upload = new WireUpload('file_upload'); // References the name of the field in the HTML form that uploads the photo
            $file_upload->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif'));
            // execute upload and check for errors
            $files = $file_upload->execute();
            // Run a count($files) test to make sure there are actually files; if so, proceed; if not, generate getErrors()
            if(!count($files)) {
                $file_upload->error("Sorry, but you need to add a photo!");
                return false;
            //echo 'photos stored';exit;
        } else {

<section class="add-location">
    <div class="container">
        <div class="row">
            <div class="col-xs-12">
                <h2>Spot toevoegen</h2>
                <form id="add-form" action="" enctype="multipart/form-data" method="post">
                    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>" />
                    <div class="col-xs-12 col-md-6">
                            <label for="fileselect">Upload jouw foto:</label>
                            <input type="file" name="file_upload" id="file_upload" accept="image/*"  class="inputfile" />
                            <label for="file_upload">
                                <span></span> <strong><i class="fa fa-upload" aria-hidden="true"></i>
                                Kies je foto…</strong>
                        <input type="submit" name="submit" value="Upload" />

<?php } } include('./includes/foot.php');?>


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...