Error in jquery uploader - SyntaxError: Unexpected token ...

Hi,

first off I really like this product, I started with it a month ago and with the information here it's been smooth sailing with only one problem ...

I'm trying to get the jquery upload to work and am getting
'SyntaxError: Unexpected token F' from chrome
and
'SyntaxError: JSON.parse: unexpected character' from firefox

In the post response in firebug I found
Fatal error: Call to undefined function array_replace_recursive() in /hsphere/local/home/rhermans/hermansnoens.com/fotos/zp-core/admin-jQuery/uploader.php on line 110

Checking the php version on the server got me a 5.2. and the array_replace_recursive function is only available from 5.3
(for as far as i know, and my php knowledge is really low)

I don't know if my provider will upgrade the php version any time soon, (just asked them) but is there any way to go around this function.

Any help is greatly appreciated.

Ronny

Comments

  • Not the full solution but a step in the 'maybe' good way

    Added next piece of code in the php section

    ////////////////////////////////////////////////////////////
    // from http://de2.php.net/manual/de/function.array-replace-recursive.php#92574
    if (!function_exists('array_replace_recursive')) {
    function array_replace_recursive($array, $array1)
    {
    if (!function_exists('recurse')) {
    function recurse($array, $array1)
    {
    foreach ($array1 as $key => $value)
    {
    // create new key in $array, if it is empty or not an array
    if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key])))
    {
    $array[$key] = array();
    }

    // overwrite the value in the base array
    if (is_array($value))
    {
    $value = recurse($array[$key], $value);
    }
    $array[$key] = $value;
    }
    return $array;
    }
    }

    // handle the arguments, merge one by one
    $args = func_get_args();
    $array = $args[0];
    if (!is_array($array))
    {
    return $array;
    }
    for ($i = 1; $i < count($args); $i++)
    {
    if (is_array($args[$i]))
    {
    $array = recurse($array, $args[$i]);
    }
    }
    return $array;
    }
    }
    ////////////////////////////////////////////////////////////

    the upload happens and goes to the correct directory
    only it generates a few more errors.
    That I've just remarked out, I'm not so far yet that I know what is happening.

    /* $image->setOwner($_zp_current_admin_obj->getUser());
    if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
    $image->setTitle(substr($name, 0, strrpos($name, '.')));
    }
    $image->save();*/

    Again this is way out what I know of php and zenphoto, but I'm learning.
  • acrylian Administrator, Developer
    I am not sure if we will change this as this is a 3rd party tool we just use (I will leave this to my colleague to decide).

    Did you try one of the two (with FTP actually three) upload ways?
  • All the other uploads are working fine,
    and what i dit here isn't a real solution.
    It's more the power of Google ;)

    Most of my work I'm busy with aspnet and stuff, and I have the jquery uploader working in some projects.

    So its just something that was bothering me, also I find that the jquery upload works fastest (except ftp, but I'm not going to give ftp accounts).

    At least I'm going to go one with this to get a more descent solution without removing code.

    Thanks for the fast response

    Ronny
  • acrylian Administrator, Developer
    All right, we appreciate that nevertheless. A way would be to contact the actual developer of the jquery uploader. Perhaps he just missed that he is using a php 5.3 only function (5.3 is of course the current PHP version, despite host not using it yet)
Sign In or Register to comment.