Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class is not defined (after following the tutorial) #1

Open
ghost opened this issue Apr 15, 2016 · 9 comments
Open

Class is not defined (after following the tutorial) #1

ghost opened this issue Apr 15, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented Apr 15, 2016

image

@ghost ghost changed the title Class is not defined Class is not defined (after following the tutorial) Apr 15, 2016
@felixkempf
Copy link
Contributor

sorry for that, forgot the frontend-bridge dependency in composer.json, which includes jinheritance.js, bringing Class and the whole inheritance functionality into JS.

Please execute "composer update" and especially follow the instructions of cake-attachments regarding the FrontendBridge.

with kind regards
Felix

@ghost
Copy link
Author

ghost commented Apr 16, 2016

Ty very much, but now there is another problem
image

@ghost
Copy link
Author

ghost commented Apr 18, 2016

        'attachments' => [],
    'attachment_uploads' => '',
    'files' => [
        (int) 0 => [
            'name' => 'googlelogo_color_272x92dp.png',
            'type' => 'image/png',
            'tmp_name' => '/tmp/phpAhRMq7',
            'error' => (int) 0,
            'size' => (int) 13504
        ],
        (int) 1 => [
            'name' => 'grigrig_testing.sql',
            'type' => 'application/sql',
            'tmp_name' => '/tmp/phpr8SwoE',
            'error' => (int) 0,
            'size' => (int) 11676
        ],
        (int) 2 => [
            'name' => 'grigrig_testing (1).sql',
            'type' => 'application/sql',
            'tmp_name' => '/tmp/phpGrmhmb',
            'error' => (int) 0,
            'size' => (int) 11676
        ]
    ]

This is entity dump after saving with attachments (article entity). 'attachments' => [] and
'attachment_uploads' => '' have no data, and it attachments don't save. Also no errors (front- or back-end). Is it my stupidity or a real problem?)

@felixkempf
Copy link
Contributor

felixkempf commented Apr 18, 2016

try giving the Attachments->attachmentsArea Helper method the correct fieldName, like so:

<?=
            $this->Attachments->attachmentsArea($entity, [
                'formFieldName' => 'attachment_uploads'
            ]);
?>

The Attachments Behavior should do the rest.

What about the JS errors? Did you fix them?

@ghost
Copy link
Author

ghost commented Apr 18, 2016

Yes, ty, fixed them, using AssetCompress. This is my variant.

echo $this->Attachments->attachmentsArea($phase, [
                'label' => 'add files',
                'formFieldName' => 'attachment_uploads',
            ]);?> 

I rly can't understand what's going on))

snapshot1

but after pressing "open", modal window closes and that's all, progress bar not moving and new files not added

@RichardMetzler
Copy link

RichardMetzler commented Apr 18, 2016

Hi, @crowd-systems
do you use any kind of access control list system in your project that may prevent you from using certain controller actions?
have you checked permissions of directories 'app_data/attachments' and 'tmp/uploads'?
If they don't allow any kind of write-access, the attachments upload won't work.

kind regards,
Richard

@ghost
Copy link
Author

ghost commented Apr 18, 2016

'app_data/attachments' and 'tmp/uploads' chmod 777
yes, I'm using acl and logged in as superuser
I tried to install you cake app skeleton, but the same issue (other things are working fine, including frontendBridge)

@ghost
Copy link
Author

ghost commented Apr 18, 2016

I've deleted all plugins ex AssetCompress, Attachments and FrontendBridge in your app skeleton and now have new error (when adding file for uploading). But now the green progressbar appears

- code: 400
message: "URL mismatch in POST data (expected '/platform/phases/edit/2' but found '/platform/attachments/attachments/upload/8268a76c'), Unexpected field 'files.0.error' in POST data, Unexpected field 'files.0.name' in POST data, Unexpected field 'files.0.size' in POST data, Unexpected field 'files.0.tmp_name' in POST data, Unexpected field 'files.0.type' in POST data"
url: "/platform/attachments/attachments/upload/8268a76c"

@ghost
Copy link
Author

ghost commented Apr 24, 2016

There is a problem with csrf token:

code: 403
message: "Missing CSRF token cookie"
url: "/platform/attachments/attachments/upload/61684abc"

Is there any normal way to fix this? Without using

beforeSend: function(xhr){
        xhr.setRequestHeader('X-CSRF-Token', csrfToken);
    },

or
Disabling whole security and csrf components ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants