unclecheese/silverstripe-dropzone

File upload "undefined" in upload url

Closed this issue · 4 comments

Hi UncleCheese,

File upload is not working after recent update.
It shows "GET http://tempsite.local/undefined" as upload url in the firebug console.

It was working fine before I run composer update.

Cheers,
Nat.

I've had this reported from a few people, but I haven't been able to replicate the bug. Can you send me your code? What does the data-config attribute look like? Does it contain a valid url?

Also, what was the last commit that worked, so I can compare them?

I created another installation and still got the same bug

data-config below:

{"acceptedFiles":".png,.gif,.jpeg,.jpg","thumbnailHeight":80,"thumbnailWidth":80,"maxFilesize":10,"url":"\/dropzone-test\/home\/logo\/field\/Logo\/upload","uploadMultiple":false,"clickable":".dropzone-select","params":{"SecurityID":"84bd06d9bb4c7280f11412781a3fcfe0aa359b84"},"thumbnailsDir":"dropzone\/images\/file-icons\/128px","maxFiles":1}

Form:

class LogoForm extends Form {

    public function __construct($controller, $name) {

        $fields = FieldList::create(
            FileAttachmentField::create('Logo', 'Your Company Logo')
                ->imagesOnly()
                ->setThumbnailHeight(80)
                ->setThumbnailWidth(80)
                ->setMaxFilesize(10)
        );

        $actions = FieldList::create(
            FormAction::create('updateLogo')->setTitle("Save new logo")
        );

        $validator = new RequiredFields('Logo');
        parent::__construct($controller, $name, $fields, $actions, $validator);
    }


}

I was able to replicate it. This should be resolved in c3f5129

Great it working :)
Thanks