Domanda

It's a long story that I'm fighting with, so I'm not going to extend to much for now, but and if not possible I will detail the problem.

I'm using Laravel framework. From an ajax call I send data from an upload form (plupload) to a function inside a controller.

Let's say I have the following functions in my controller:

function action_tempupload()
{
    $temp = array();
    $temp[] = Input::all();
    return true;
}

function action_upload($news_id)
{
    global $temp;
    $input = $temp;

    echo "<pre>";
    //print_r($news_id);
    print_r($input);
    echo "</pre>";
    exit();
}

function action_save($parameters = array())
{
        // create news record in database and
        // have a variable containing the news id sent to:
        $this->upload($mysql->news_id);
}

Is it possible to have an temporary array, that saves each POST of the form for the image upload and call the array later in another function?

È stato utile?

Soluzione

If they're are separate requests, then you can just store the array in a $_SESSION and unset all the created sessions in the last action method.

Click on the link of you need to know more about $_SESSIONS. The usage is pretty straight forward.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top