Problem with jQuery uploads?

Hello,

I'm trying to populate a gallery. And although I can do it by FTP, I want to make sure it works via the gallery interface.

So far, I have the following results:
– Uploading a zip file via http works fine, except for lack of feedback.
– Uploading a zip file via flash works fine. It's unfortunate that "zip" is not part of the allowable zip files, but once I select "show all files", I am able to upload a zip file successfully.
– Uploading a zip file via "jQuery" doesn't work. The file is completely uploaded, but then, I get the following error message:
church-building02.zip 50.27 MB
Error: SyntaxError: JSON.parse: unexpected character
(and the garbage can appears at the end of the line,
but nothing happens when I click on it)
– Same problem happens when I load a batch of jpg files... or even individual files

Question: Is it a problem with the jQuery language, my setup... or my own problem? As far as I know, there are no space or accented characters in the file names, whether on my own hard disk or on the server.

Thanks
***************

Paths on the server:
/photos/albums/church-building
(uploaded photos are going in that folder)
File names on my own hard disk:
F:\SITES\SiteWeb_StJames-2011\photos\albums\church-building
File uploaded: church-building02.zip
with file names such as NamesThroughHistory_DSC_6506.jpg

Zenphoto setup
Zenphoto version 1.4.2 [9095] (Official Build)
Current locale setting: en_US.UTF8
Current gallery theme: Zenpage_sja (same problem occurs with Zenpage)
PHP version: 5.2.17
Graphics support: PHP GD library bundled (2.0.34 compatible)
PHP memory limit: 200M (with 80 Mb per file)

Plugins :
Only the standard ones are there. All activated except:
admin-approval
ajaxFilemanager
downloadList
dynamic-locale
email-newuser
federated_logon
GoogleMap
googleVerify
image_effects
jplayer
quota_manager
Rating
register_user
show_not_logged-in
static_html_cache
tweet_news
user-expiry
wordpress_import
xmp_Metadata

Comments

  • I did try to upload a zip file with jQuery. I did not get the error you describe, but the zip was also not unpacked. The debug log indicates that the upload handler treated the file as an image and did not unzip it. Have you something in your debug log related to the upload?

    Individual files do seem to work correctly.
  • Hello,

    This morning, I tested with Firefox 10.0.2 on Windows 7. Tonight, I tried uploading a single file and got the following error message with Firefox 10.0.2 on Windows XP
    CopiedeDSC_6630.jpg -- 3.27 MB
    Error: SyntaxError: JSON.parse: unexpected character

    I have the same problem with the latest Chrome.
    On the other hand, Opera 11.61 processes the file for about 1 minute, then goes back to the album view (list of images)... but without the new images. Internet Explorer 8 on XP uploads the images as it should.

    ********************

    Debug Log file:
    This is the most recent entry, and I have a few like that from a few minutes before that and from Tue Feb 21 at 2:00 GMT. Yet interestingly enough, I tried that function this morning (at around 9:30 a.m., and tonight at 21:45 (Eastern Time), but never yesterday. And the administrative overview page shows the correct time.

    `

    {Wed, 22 Feb 2012 02:14:01 GMT}

    Backtrace: Bad gallery in instantiation of album worship-and-education.

    Album->__construct called

    from getUploadLimitedAlbums (image_upload_limiter.php [179])

    from uploadLimiterJS (image_upload_limiter.php [79])

    from call_user_func_array (unknown)

    from zp_apply_filter (functions-filter.php [149])

    from admin-upload.php [300]

    Backtrace: Bad gallery in instantiation of album worship-and-education.

    Album->__construct called

    from getUploadImagesInAlbum (image_upload_limiter.php [207])

    from uploadLimiterJS (image_upload_limiter.php [80])

    from call_user_func_array (unknown)

    from zp_apply_filter (functions-filter.php [149])

    from admin-upload.php [300]

    `

    Tell me if you need other info.

    Thanks
  • sbillard,

    I have uploaded the complete debug log here:
    http://stjamestheapostle.ca/ZP_sja220222_debug.zip
  • I also have issues with anything but http uploads, I get re-directed to the public side of the album with "Sorry, the page you requested cannot be found". The URL reads:

    /zp-core/undefined&album=&publishalbum=checked&albumtitle=&folderdisplay=&autogen=checked&new

    This happens if I attempt to switch to jQuery or Flash uploader.
  • Please disable the `image_upload_limiter` plugin and see if things then work.
  • Hello,

    I'm back on Firefox 10.0.2 with Windows 7 (French).

    When I disable image_upload_limiter and only that one (quota_manager was already disabled), I get the same error message:
    CopiedeDSC_6629.jpg -- 2.99 MB
    Error: SyntaxError: JSON.parse: unexpected character

    I also get the feeling that even though I have disabled "image_upload_limiter" (and even logged off, then on), it still is active somehow.

    I tried to disable most plugins, then to activate all default plugins except jPlayer, and no change.

    For your info, when all extensions were enabled, I had:
    – image_upload_limiter: Allow album creation; 999 files
    – quota_manager : Allow zip files; quota: 250 000 k
    and I tried more "reasonable" limits of 99 files and 25 000 k
    I then reset the limits to the larger numbers and disabled those two extensions.

    In the unlikely case it would be a problem, I also changed the name of the file to something totally different: no change.

    Still... same result : it doesn't work with Firefox and Chrome, and the content of the log file doesn't change, whether extensions are off or on..

    Regards

    *************************

    Log file : `

    {Thu, 23 Feb 2012 13:27:46 GMT}

    Backtrace: Bad gallery in instantiation of album worship-and-education.

    Album->__construct called

    from getUploadLimitedAlbums (image_upload_limiter.php [179])

    from uploadLimiterJS (image_upload_limiter.php [79])

    from call_user_func_array (unknown)

    from zp_apply_filter (functions-filter.php [149])

    from admin-upload.php [300]

    Backtrace: Bad gallery in instantiation of album worship-and-education.

    Album->__construct called

    from getUploadImagesInAlbum (image_upload_limiter.php [207])

    from uploadLimiterJS (image_upload_limiter.php [80])

    from call_user_func_array (unknown)

    from zp_apply_filter (functions-filter.php [149])

    from admin-upload.php [300]

    `
    (Interestingly, whereas yesterday's log time was totally wrong, today, the log time is almost OK: 16:11 Eastern, or 13:11 Pacific, which is where the server is located).

  • Be sure you have deleted your log file before testing. If this is the current set of errors then you have not somehow managed to disable the image_upload_limiter. Not at all sure how that could happen. Anyway, these errors certainly would prevent a successful upload.
  • Hello,

    I have even removed the image_upload_limiter plugin and there is no change.

    I have also reset the debug log file. No entries appear in the file when I try uploading stuff.

    I have tried another gallery (in French), on a different server but with the same characteristics and I have the same behaviour. And the same thing happens if ModRewrite is disabled.

    Finally, I then tried on the local server (Windows XP running XAMPP, with modRewrite disabled), and it works on that one!

    ***********************

    Sbillard,

    I just looked around the forum for other clues, and my problem seems very similar to what is described here:
    http://www.zenphoto.org/support/topic.php?id=10236

    Regards,
  • Well, we never did understand that one either.
  • Gosh! Thought it would help!

    Could it be that the jquery routine (or its implementation) is different on Apache vs XAMPP on Windows? Or could it be related to the version of Apache server or of PHP?

    My online servers have the following credentials:
    – Apache 2.2.21
    – PHP 5.2.17

    My local server has the following credentials:
    - XAMPP portable with Control panel 2.5 (16 March 2011)
    – Apache 2.2.21
    – PHP 5.3.8

    Although it doesn't have a real impact on gallery use and configuration, I also see a difference between the Admin Toolbox which, for the administrator, has 14 items on the local server and 5 items on the (remote) online server.

    Do you have an idea where I could start looking for "understandable" information on the differences between PHP 5.2.x and 5.3, or the jquery routines used to upload files?

    Regards,
  • acrylian Administrator, Developer
    jQuery is a javascript framework and runs in the browser and not the server. Since uploading involves browser, desktop system and server as well I cannot say more. Don't know the details. You could search the net if there are any issues with this tool know since it is adapted.
  • Thanks. I'm putting it on the back burner for now, but I will eventually look at it.

    Even though jQuery is a javascript framework, I suspect it calls procedures that may behave slightly differently with different versions of Apache or PHP (most likely). Otherwise, I can't see why things don't work remotely, whatever browser I use, whereas things work fine on the local server.

    The only other possibility I see might be obscure php.ini flags (all the ones described in setup.php and in the documentation are set up correctly).
  • acrylian Administrator, Developer
    Sure that will go hand in hand. That's why I suggested to search the web for known issues.
  • Interesting. I don't have the time and photos to experiment uploading with different settings at this time, but I checked and permissions are all at 755, meaning "I" can write, but neither the "Group" nor the "World" can.
    Are there any differences (for the host, I mean) between who is the user when a file is stored by http vs Flash (both work) vs jQuery?

    And P.S. By the way, who is the "Group"?

    Regards,
  • "group" is a Unix securiy concept. It is basically a collection of users someone defines. So there might be an `administrators` group consisting of `user1`, `user2`, etc. So if any of those users tried to access the file (and were not the owner) they would be assigned the "group" permissions.
  • I see. Anyway, I just tried to upload a file after setting permissions to 777 and it doesn't work out either. (I would not have considered it a permanent solution, but it might have provided a clue...)

    I also ran Firebug and asked the console to provide me all error messages and warnings. Nothing interesting, except nothing happens:
    `

    POST http://stjamestheapostle.ca/photos/zp-core/admin-jQuery/uploader.php

    –> 200 OK - 14.86s

    –> jquery.js (ligne 4)

    En-têtesPost

    (Nothing in the table)

    (warning) The « nodeName » attribute is obsolete. Use « name » instead.

    –> jquery.js (ligne 2)

    (warning) The « nodeValue » attribute is obsolete. Use « value » instead.

    –> jquery.js (ligne 2)

    `

    The last two warnings seem trivial (other working features provide plenty of warnings. As for the first line, if I understand correctly, it means the POST command is sent but that nothing is transferred.

    I looked at different memory-related php.ini parameters. I don't find a "allowed_memory_size" that was referred to in the link sbillard provided. Here are the other memory-related parameters I have:`

    memory_limit: 200 Mb

    post_max_size: 150 Mb

    upload_max_filesize: 80 Mb

    upload_tmp_dir: no value (do we need to define one?)

    user_dir: no value (do we need to define one?)

    json 1.2.1 enabled`

    I tried to look at the code, but my PHP skills are a bit minimal...

  • I had the same problem but found that my problem lies in the fact that I use uppercase letters. If I convert the letters to lowercase I have no problems. So I suspect that the filename is converted to lowercase during the upload process and thus not matching to the original in the end causing a JSON failure.

    As a workaround I now convert my filenames until I have the time to find this particular line.

    For photo folders I use an automator script to convert all filenames at once/in batches, which I found on a forum here: http://forums.macrumors.com/showthread.php?t=817077
  • I would assume you would need an `upload_tmp_dir` defined. There certainly is one defined in my php.ini file. But of course, it could default to something. `user_dir` is not defined in my installation, so I presume it is not needed.
  • Si it's probably not needed, because if I remember correctly, those directories won't be created automatically if they are needed.

    Anyway, neither phpSavePath nor upload_tmp_dir were defined. So I defined them within my php.ini file and I created those folders. No change.

    Two other interesting bits of information:
    – I used only lowercase letters (dsc3443.jpg) : no change.
    – I tried to upload two photos and create a new unpublished sub-album at the same time. The sub-album was indeed created, but no photos were uploaded. Nothing was saved in the upload_temp_dir directory, and the following was saved in the phpSavePath directory:`

    file: sess_137with quite a few letters at the end

    content: uploadtype|s:6:"jQuery";`
  • I did look at the script. The destination of the upload should be into your "album" folder. But I do not know what intermediate storage the script might use.
  • Indeed, and that's where the sub-album was created (in /albums/people as requested). No idea about intermediate storage either. It feels like everything is uploaded "somewhere somehow", then the script does something illegal...
  • So, then, any error messages anywhere? You might also see if there is any help at http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Support
  • Error messages : nothing really. I have posted a few before, but I don't see anything significant. As if the file simply "disappeared". It seems to upload completely than stop during parsing
    `(SyntaxError: JSON.parse: unexpected character)`

    When I peruse through the zp-core/admin-jQuery folder, am I right to figure that `upload_form.php` and `uploader.php` are yours, while the others are from the jQuery Uploader developer?

    I had looked before at the site referred to in the header of the jquery.fileupload.js file and I haven't found anything. I'll look at the discussion forum to see if, by any chance, I find anything.
  • acrylian Administrator, Developer
    Yes, those two files are the ones by us.
  • uploader.php contains a jquery class definition that came with the package.
Sign In or Register to comment.