This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

henryjevans26521
henryjevans26521

Hi,

So, i'm running into a new issue with backend images in October which i've not seen before.

Symptoms : When creating a record in a backend form (Made using builder plugin ) The image appears to have uploaded. After the record is created the image uploader cannot find the image, neither can it be found when the models attachments are queried on the frontend - re-uploading the image (after initial creation) to the record tends to fix the issue.

I note that looking in storage/app/uploads/etc. the files -ARE- in there, but they don't seem associated with the record. The definition for the attachments looks like this:

public $attachOne = [ 'obv' => 'System\Models\File', 'rev' => 'System\Models\File' ];

I'm not sure what would cause this to happen. I can't see any errors etc. that shed light on the problem.

EDIT: Looking at the SQL database in the "system_files" table - it appears the issue is, is that the "attachment_id" column is not being set to the ID of my record.

Anybody seen this before?

Thanks

Last updated

henryjevans26521
henryjevans26521

Hi,

So I have fixed this in a very peculiar way. Setting my primary key to auto-increment did the trick, not sure why this is, bug perhaps?

https://octobercms.com/forum/post/howto-use-a-different-primary-key-than-id-in-a-model-or-controller

this might hint at why.

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.