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 6165767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:13:24+00:00 2026-05-23T22:13:24+00:00

First let me say sorry for the amount of code I’m posting below I’m

  • 0

First let me say sorry for the amount of code I’m posting below I’m going to try and keep it as short as possible but this is built on top of my MVC (lightweight-mvc)

Ok So my Problem is that for some reason php is throwing a fatal error on code that should not be being used in my current code,

So how this works I have my MVC witch used the first 2 parts of the url to know what its loading, the problem is I’m building a Moulder CMS into my MVC so it’s boot strapping twice,

So here is my Problem,

http://{domain}/admin/control/addon/uploader/method/uploadCheck/

I’m using the above now let me explain a little into that the /admin/control are for the main MVC System it auto-loads the Admin controller then fires the controlAction method from the controller much the same as most MVC’s,

The next part are URL paramters that build an array the same as GET or POST would

array('addon'=>'uploader', 'method'=>'uploadCheck')

So from that my control action will auto load as is the code below

public function controlAction(){
global $_URL;
if(cleanData::URL("addon")){
        $addonName = "addon_".cleanData::URL("addon");
        $methodName = (cleanData::URL("method"))? cleanData::URL("method")."Action" : "indexAction";
        echo $methodName;
        $addon = new $addonName();
        $addon->$methodName();
        return;
    }else{      
        $this->loadView("CMS/controll");
    }
}

cleanData::URL is an abstract method that just returns the value of the key provided though addSlashes()

So as you can see from the code below it will then use the autoloader to load the module(AKA addon)

Just so you can follow the auto loader works in a simpler version of the Zend Frame work autoloader _ so you have class name addon_admin that would be inside file admin.php that is in the folder addon so the autoloader will load addon/admin.php

So As above with my URL and controlAction it’s loading addon/uploader.php and as such this is the contents

<?php
class addon_uploader extends Addons{

    public function uploadCheckAction(){
            echo 0;
    }

    public function uploaderAction(){
        if (!empty($_FILES)) {
            $tmpFile = $_FILES['Filedata']["tmp_name"];
            $newLock = "../uploads/".end(explode('/', $tmpFile).$_FILES['Filedata']['name']);
            move_uploaded_file($tmpFileName, $newLock);

            $POSTback = array(
                'name' => $_FILES['Filedata']['name'],
                'type' => $_FILES['Filedata']['type'],
                'tmp_name' => $newLock,
                'error' => $_FILES['Filedata']['error'],
                'size' => $_FILES['Filedata']['size']
            );

            echo json_enocde($POSTback);
        }
    }
}
?>

But as you can see from my URL its using the uploadCheckAction method witch for debugging i have set so it always says false (AKA 0),

But i seem to get this error:

Fatal error: Only variables can be passed by reference in C:\xampp\htdocs\FallenFate\addon\uploader.php on line 11

But line 11 is $newLock = "../uploads/".end(explode('/', $tmpFile).$_FILES['Filedata']['name']); witch should not be being used could any one provide any help into why this would occur and how i could fix it

  • 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-05-23T22:13:24+00:00Added an answer on May 23, 2026 at 10:13 pm

    end() PHP Manual needs an expression of a single variable (more precisely an array), but not a function return value or any other type of expression.

    I think that’s basically the cause of your error, more specifically with your code:

    $newLock = "../uploads/".end(explode('/', $tmpFile).$_FILES['Filedata']['name']);
    

    you’re even driving this far beyond any level of treatment PHP can cope with:

    1. you concatenate an array with a string (which results in a string).
    2. you run end() on that string – not on a variable, not even an array.

    I have no clue what you try to do with the code, but I can try:

    $filename = $_FILES['Filedata']['name'];
    $parts = explode('/', $tmpFile);
    $last = end($parts);
    $newLock = "../uploads/". $last . $filename;
    

    Or probably even only this:

    $filename = $_FILES['Filedata']['name'];
    $newLock = "../uploads/". $filename;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, let me say I'm not a professional programmer, but an engineer who had
First of all, I want to know if this is possible: let's say I
First off let me say I am maintaining someone else's poorly designed code so
I have a question, but let me first say that this is being performed
First let me say I really sorry for asking a question about facebook. I'm
First let me say I'm fully aware sql server does not short circuit evaluate.
First let me say that I really feel directionless on this question. I am
Let's say the first N integers divisible by 3 starting with 9. I'm sure
Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2},
First, let me say that I'm a complete beginner at Python. I've never learned

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.