CMS MADE SIMPLE FORGE

Company Directory

 

[#10009] Multiple custom fields of type image results in only one image upload

avatar
Created By: Jonathan (jpmad4it)
Date Submitted: Thu May 29 03:58:00 -0400 2014

Assigned To: Robert Campbell (calguy1000)
Version: 1.21.1
CMSMS Version: 1.11.10
Severity: Major
Resolution: None
State: Open
Summary:
Multiple custom fields of type image results in only one image upload
Detailed Description:
I have multiple custom fields created of type "image". The allowed extensions
are jpg,gif,png.

When submitting a new company using the default front end form, it seems that
only one image will ever be uploaded even if more than one custom field of type
image has an image selected for it.

This has been submitted as a bug a few times before, but it still seems to be an
issue for people using the module.


History

Comments
avatar
Date: 2014-05-29 06:42
Posted By: Jonathan (jpmad4it)

This code seemed to help somewhat, but hasn't solved the issue fully.

After ...
                        $rec = $fielddefs[$fid]; // it had better exist.
add
$customdownload[$fid] = $data['name'];

and change ...
                $res = $uploader->handle_upload('cd_field_'.$fielddef->id);
to
$res = $uploader->handle_upload('cd_field_'.$fielddef->id,
$customdownload[$fielddef->id]);

If I try to upload 7 files with the names:
new.jpg
new_2.jpg
new_2_.jpg
new1.jpg
new3.jpg
new4.jpg
new6.jpg

The only files that ever get uploaded are:
new.jpg
new_2.jpg
new_2_2.jpg
new1.jpg

The others are never uploaded.

If you require a link to test this please let me know, I'd be happy to provide
it.
      
avatar
Date: 2014-05-29 07:09
Posted By: Jonathan (jpmad4it)

It appears that 2 images are never uploaded. I cut down my custom image fields
to 5 instead of 7, and only 3 images out the total 5 were uploaded.
      
avatar
Date: 2015-03-04 14:11
Posted By: Jack Skiba (nidus)

the problem still exists, with cd_logo and cd_image, didn't test the custom
fields.

the problem is with _destname in class.cg_fileupload.php
the action.fe_edit2.php calls uploader (cd_upload_hendler) that calls
cge_uploader that calls class.cg_fileuplod.php
if from action.fe_edit2.php was a method to reset the _destname when new
uploader is called that would work just fine
right now it remembers the first or previous value in the loop
this can be solved by changing the class.cg_fileupload.php, but it may affect
other module.
The best would be to reset it to null in action.fe_edit2.php

If someone does know how to do it please post it here.

      
Updates

Updated: 2014-05-29 06:42
resolution_id: => 5