Skip to content
This repository was archived by the owner on May 21, 2021. It is now read-only.
This repository was archived by the owner on May 21, 2021. It is now read-only.

Missing feature: Remove uploaded image #15

Description

@marble

Description:
Lets say our domain object has a $logo and a $firstName. When editing the record you can set and then empty $firstName back and forth. But with the current version of upload_example you CANNOT remove a $logo once it's uploaded. That should be possible as well.

What I've tried
... works only partly. That is, it works as long as objects are not persisted. I've added a checkbox for removing

724

In Fluid:

<f:form.checkbox name="offer[logo][submittedFile][remove]" value="remove"
                      id="logoSubmittedFileRemoveField"/>

And a clause in the UploadedFileReferenceConverter.php:

public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL) {
    if (!isset($source['error']) || $source['error'] === \UPLOAD_ERR_NO_FILE) {
        if (isset($source['submittedFile']['remove']) && strlen($source['submittedFile']['remove'])) {
            // No new file is uploaded and the 'remove' checkbox is checked.
            // Forget a possibly attached resource
            return NULL;
        }
        if (isset($source['submittedFile']['resourcePointer'])) {
   ...

Good:
This works for non persisted files.

Bad:
It's not enough to just remove a file (reference!) in that way if it's persisted before. So you get for example:

725

Missing:
Code to delete the (FAL) file reference.

Sorry...
I'm trying to dive into extbase and fal and so ... but I'm not ready to come up with a solution yet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions