@Hattori thx for replay
I have still problem with attach, the same like @Liam
Sorry for bad English
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
@Hattori thx for replay
I have still problem with attach, the same like @Liam
Sorry for bad English
I did a quick test yesterday with 1 image and it uploaded to the custom folder I specified. That didn't seem to be the issue. The issue was not being able to edit or remove them like shown in the screenshot I posted.
This happens with or without setFolderName(); being called.
@Liam Thx for the correct
Never mind
I think I got this working now. Using the many_many relationship instead of has_many as I got the path error bug as well.
Then I removed the $this->Images() from the UploadField and everything is working and I can now edit/remove images attached to pages.
I did find another bug I think in that setFolderName() can't take spaces. When I use 'FolderName' it doesn't create a folder with a space in it like I thought might, so I tried doing 'Folder Name' and while it creates the proper name with the directory being 'Folder-Name' uploads fail for some reason. URL looks correct but always 404.
@Craftnet The other topic is setup to use the name screenshot, your code isn't obviously. The names of the field have to match the db stuff.
Keep your latest code and switch the has_many to a many_many and then run dev/build and see what happens.
finally :)
Thanks @thi3r
Thanks @Hattori
Thanks @Liam for the final solution
@Liam: all physics files and folders are now converter automatically to alphanumeric characters and dashes
One last thing.
How do I access the variable in a loop?
I have this
<% loop Images %>
<a href="$SetWidth(800).URL">$CroppedImage(160,160)</a>
$Image.Width
<% end_loop %>
$Image.Width is what doesn't work, everything else is fine. Tried a bunch of var names and nothing works.