e.g adhering to acceptance criteria #2

Show 1 attachment(s)

As a user, I want to be able to replace a file, so that I can have a new file downloaded from an existing URL.

Acceptance criteria

• On the file detail view, there is a replace action, that allows the uploading of a single file • If the replace action is used, the resulting URL is the same as the previous file, and the old file is tracked in the version history • If you upload a file with a different extension, it warns that the URL will change • If you upload a file with an invalid extension, it will throw an error


• When bulk uploading files, if there is a file of the same name already in the folder, an option to replace exist (separate story)


☑︎ Create a preview image component, which handles rendering the preview and icon-bar to the right. ☑︎ Update FormFactory to use the preview image component. This allows the submission of new file tuple (Filename, Hash, Variant) to replace the contained DBFile. ☑︎ Show progress of upload for replacement ☑︎ Add endpoint for uploading the replacement image. ☑︎ Ensure that component is updatable via state (from form submission returning updated formschema state). ☑︎ Check for different file extension and display a warning ☑︎ Unit tests ☑︎ Behat tests

Pull requests|#339|silverstripe/silverstripe-framework#6428

Hide attachment content

heyo When using the replace file functionality within the CMS (SS4.3) Files section, if the new file has different contents to the previous file, the link is updated with a new hash. I understand this is how the hash is calculated, but doesn't this make the "replace file" functionality pretty useless?

e.g I have a "term and conditions" file littered throughout my site (both dynamic file links "in content" and hard coded references e.g links sent out in emails and in pdf's

so every time the terms and conditions need to be updated, I would like to use the "replace file" functionality so that the hardcoded link in emails and pdfs still work. Instead the "replace file" destroys the old link AND creates a new link (with a new hash) that no one knows about

am I missing something?


all good..i just worked it out...if anyone else is interested, it goes a little like this

  1. $partners = Partner::get()
  2. ->leftJoin('Client','Client.PartnerID=Partner.ID ')
  3. ->alterDataQuery(function(DataQuery $query){
  4. $query->selectField('(SELECT COUNT(Client.ID) from Client '.
  5. 'WHERE Client.PartnerID=Partner.ID)', 'ClientsCount');
  6. $query->groupBy('ClientsCount DESC');
  7. });

hey all - SS4 question if I have an object say Partner and it has_many Clients do you know how i can sort on the number of clients e.g

  1. $partners = Partner::get()->sort(['Clients.Count' => 'ASC']);

but that doesnt work any ideas of how to do this?


hey @nils I just updated our nested mutations module. We are using it in a couple of different sites and its working really well for us. Let me know what you think, but I think it'll do what you want


hey can anyone point in the right direction on how to get started about uploading a file from react via graphql? Is it possible to extract the upload field in the assets admin module and use in my own frontend, or does anyone know of another way?


Thanks 🙂 Yep, i'll have ago at implementing this


Yeah - fully recommend you chat with @unclecheese or something about it.


FYI @sminnee and @unclecheese I had ago at implementing the multipart request spec way outlined in that link above. The code is very very alpha, but in general is working very well, and quite easily 🙂

Show 1 attachment(s)