[Vtigercrm-commits] [Vtiger development] #7899: Import upload max size

Vtiger development vtiger-tickets at trac.vtiger.com
Mon Jan 13 11:47:33 GMT 2014


#7899: Import upload max size
-----------------------+------------------------------------
 Reporter:  opensaas   |      Owner:  developer
     Type:  patch      |     Status:  new
 Priority:  minor      |  Milestone:  Unassigned
Component:  vtigercrm  |    Version:  6.0.0 RC
 Severity:  Medium     |   Keywords:  import max upload size
-----------------------+------------------------------------
 Hi,

 By default Vtiger has 3MB file upload size. This is insufficient size for
 bigger imports.

 In config.inc.php there is variable $upload_maxsize, but changing it
 didn't work for me. No matter how big the number was, I was always
 notified that the file is bigger than 3MB.

 And so the problem is that the import max upload size is set as a constant
 number in Import.php (modules/Vtiger/views/Import.php)  on line 99.

 To fix that I have switched:

 {{{
 $viewer->assign('IMPORT_UPLOAD_SIZE', '3145728');
 }}}


 to:

 {{{
 $viewer->assign('IMPORT_UPLOAD_SIZE', vglobal('upload_maxsize'));
 }}}


 That was max upload size is beign set up in config.inc.php.

 One more fix is in Import.js in Import module. Error notification always
 notifies about 3MB limit.

 To fix that replace function uploadFileSize on line 105 with:
 // ---

 {{{
 uploadFileSize : function(elementId) {
                         var element = jQuery('#'+elementId);
                         var importMaxUploadSize =
 element.closest('td').data('importUploadSize');
                         var uploadedFileSize =
 element.get(0).files[0].size;
             var limitMB = importMaxUploadSize / 1048576;
                         if(uploadedFileSize > importMaxUploadSize){
                                 var errorMessage =
 app.vtranslate('JS_UPLOADED_FILE_SIZE_EXCEEDS')+" "+limitMB.toFixed(2)+"
 MB." + app.vtranslate('JS_PLEASE_SPLIT_FILE_AND_IMPORT_AGAIN');
                                 var params = {
                                         text: errorMessage,
                                         type: 'error'
                                 };
                                 Vtiger_Helper_Js.showMessage(params);
                                 return false;
                         }
                         return true;
                 },
 }}}

 // ---

 Variable limitMB converts limit in bytes to MB and is included in the
 notification message instead of "3".

--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7899>
Vtiger development <http://trac.vtiger.com/>
Vtiger CRM


More information about the vtigercrm-commits mailing list