luckydead's avatar

Issue with read information

Hello i'm having issue with my code

Correctly in my admin cp>package>gold package> for upload pictures is set to -1 (that means unlimited images to upload)

But when user is with package Gold then he cannot upload any images it directly shows error Limit Exceeded. If i change the setting -1 to 3 then he can upload normal 3 images and no more.

inside my code where users try to upload the img i have this code:

$limit_photo = isset($activePackage['number_of_photo']) ? $activePackage['number_of_photo'] : 0;

->add('images', 'multipleUpload', [
                'label'      => trans('plugins/real-estate::property.form.images'),
                'label_attr' => ['class' => 'control-label'],
                'attr'       => [
                    'data-max' => $limit_photo
                ]
            ])

Any ideas how to make it to support correct -1?

Here is the upload function for images

var max_count = $('#images').data("max");
init: function() {
            this.on("addedfile", function(file) {
                if (max_count < uploadedImages.length + 1) {
                    this.removeFile(file);
                    Botble.showError("File Limit exceeded!");
                    return false;
                }
            });
        }
    });
0 likes
1 reply
luckydead's avatar
luckydead
OP
Best Answer
Level 1

if (max_count != -1 && max_count < uploadedImages.length + 1) { This is the solution

Please or to participate in this conversation.