We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19388
    • 297 Posts
    Hello,
    I’m testing MaxiGallery and I get an extrange error. If I upload a zip with 3 files ( 300KB ) or individual images, it gets uploaded without problems. But if I upload to the same resource a zip with 52 images ( < 5MB ), I get a CHMOD error:
    PHP error debug
    Error: chmod() [function.chmod]: No such file or directory
    Error type/ Nr.: Warning - 2
    File: /home/salapara/public_html/assets/snippets/maxigallery/maxigallery.php
    Line: 372
    Line 372 source: chmod($mg->path_to_gal.$name,0666);

    It cannot be a permissions error because the error does not ocurr always, only with the large zip. My server upload limit is 10MB

    Any idea about what can be happening?
    Thanks

    EDIT: using version 0.5.2

    EDIT2: I made this change to script on lines 371-378:
    					if(move_uploaded_file( $_FILES['file'.$i]['tmp_name'] , $mg->path_to_gal.$name )) {
    						chmod($mg->path_to_gal.$name,0666);
    						
    						$handleMessage = $mg->handleFile($name, $modx->db->getRecordCount($rsx));
    						if ($handleMessage != "") {
    							$manageOuterTplData['messages'] .= $handleMessage;
    							$upload_error = true;
    						}
    					}


    The problem dissapear, but it uploads only 3 images at first time, and zero in a second try and others. It only creates the folder

    EDIT3: Same problem with version 0.6, but in version 0.6 there is not error message. A succesfull message is shown but no images are uploaded.

    EDIT4: Debugging i’ve detected that there is an error uploading the file, and move_uploaded_file does not work in this case:
    if (move_uploaded_file( $_FILES['file'.$i]['tmp_name'] , $mg->path_to_gal.$name )) {

    The function returns false, but it seems the file is uploaded because I can get the tmp_name

    EDIT5: Testing, testing and more testing... It seems to not be a problem zip related. The problem can be with "large" files. With any file ( zip, jpg... ) larger than 3MB aprox. I get problems. But my question is... why? If my max_upload_size is 10MB, if I have no problems with other scripts ( outside modx )... The problem happens when uploading only one large jpg too (3,6MB), I think it cannot also be a memory allocated problem... I’m going crazy :S

    EEEDIT6:
    Not working, tried setting:
    ini_set(’max_execution_time’,’600’);
    ini_set(’max_input_time’,’600’);
    ini_set(’memory_limit’,’100’);
    ini_set(’post_max_size’,’10’);
    ini_set(’upload_max_filesize’,’10’);
      • 7923
      • 4,213 Posts
      It’s definitely an issue with your server not being configured to handle such large files and it stops maxigallery execution.

      Your server might not allow setting the values using ini_set().

      Try running ini_set() and phpinfo() after those to see if the values are actually changed. MaxiGallery wiki page has some information about the settings and what you should try to modify.

      If possible, change the values straight in php.ini file.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 19388
        • 297 Posts
        Wow, now it works. The problem was solved allowing 1024MB of memory! Is that ammount normal? :S
        Thanks for your help
          • 7923
          • 4,213 Posts
          No.. it’s not normal on good applications.

          I haven’t done much of optimizing in MaxiGallery though and uploading many (big) files in a single zip file can take alot of memory while processing.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."