theruss

So you can or can't see the related object within the draft page? (Sorry, just trying to establish if you have a typo or not)

adrianstein

Hey guys, I have a page with a $has_one that selects a dataobject which has $extensions = Versioned::class When I publish the page even though the page as $owns on the same dataobject I cant see the object when I view the live page. I can see it when viewing the draft page tho. Do I meed to so anything else or should I call the dataobject differently from the front end. Any ideas?

nicolaas

does anyone know how to create an image when the file already exists?

taoceanz

What do you mean by saving to a page? I'd think you should be able to use a standard front-end form with an UploadField that permits only particular file types. Then when the form is saved and validated, it saves to a DataObject of your creation which is a $has_many on your page. Page has many object which each have an image. Page displays images from it's $has_many objects. You'd have to do decent validation on what the user uploads though.

Jack

Hi folks. What's the best way to handle front end image upload in SS4? Any link to a resource on this would be appreciated. My form needs to save the image to a Page.

taoceanz

yeah nah it's just a file on the system which has nothing inherent to do with SilverStripe.

👌 (1)
nightjarnz

depends on where your asset store is @taoceanz - if this isn't an asset though, then go for gold fopen or whatever

taoceanz

Sweet. Was unsure whether there was a SS specific file reader which would be a better option.