ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

File upload error with different locale

September 20, 2012 4:16am

Subscribe [1]
  • #1 / Sep 20, 2012 4:16am

    Est Digital

    62 posts

    This question may be related to a resolved thread.


    When I upload a file through the filemanager, I get the following error:

    A Database Error Occurred
    
    Error Number: 1136
    
    Column count doesn't match value count at row 1
    
    INSERT INTO `exp_files` (`upload_location_id`, `site_id`, `file_name`, `mime_type`, `rel_path`, `modified_by_member_id`, `uploaded_by_member_id`, `file_size`, `file_hw_original`, `modified_date`, `title`, `upload_date`) VALUES ('1', '1', 'temp_file_demo-winterlandschap1.jpg', 'image/jpeg', '[removed]/temp_file_demo-winterlandschap1.jpg', 1, 1, 410583,04, '600 960', 1348128239, 'temp_file_demo-winterlandschap1.jpg', 1348128239)
    
    Filename: models/file_model.php
    
    Line Number: 219
    
    « Terug


    In system/expressionengine/config/config.php I’m using:

    date_default_timezone_set('Europe/Amsterdam');
    setlocale(LC_ALL, array('nl_NL.UTF-8', 'nl_NL@euro','nl_NL','dutch'));

    Shouldn’t the the file size get saved in a format that isn’t changed by locale settings?

    Also, for some reason, the DB layar (EE->db->insert(..)) doesn’t escape “410583,04”, resulting in the column count error.

    Is there an easy fix for this, without changing the locale?


    (EE versions: 2.5.2, 2.5.3)

     

  • #2 / Sep 21, 2012 5:53pm

    Kevin Smith

    4784 posts

    Hi Kees Internet,

    If you take that out of your config.php, does the problem still occur? I suspect not, and it’s my guess that what’s happening here is that because the locale is changing, the decimal separator is changing as well. “410583,04” should probably be 410583.04, and when you remove the directive to set locale, it will use a decimal point again.

    Why do you need to change the locale using the PHP function?

  • #3 / Sep 27, 2012 9:12am

    Est Digital

    62 posts

    Uploading works fine without the setlocale, but the rest of the site shows wrong formats.

    I’m using the locale for formatting currencies, numbers and months throughout the websites. I’m planning on using different locales for multilanguage sites as well.

  • #4 / Sep 27, 2012 9:16am

    Est Digital

    62 posts

    shouldn’t db->insert escape 410583,04 as “410583,04”?

  • #5 / Sep 27, 2012 5:02pm

    Kevin Smith

    4784 posts

    Yep, I figured it was using setlocale that did it. That form of localization isn’t compatible with EE for the reasons you’ve run into. Even if 410583,04 were entered into the database without error, EE’s not set up to use a comma as a decimal separator.

    Could you give me an example of the site’s formats that this is intended to resolve?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases