Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no validation under 4.13 by saving changes in user/member profiles #27

Open
Ainschy opened this issue Sep 5, 2022 · 3 comments
Open

Comments

@Ainschy
Copy link

Ainschy commented Sep 5, 2022

If an image is to be deleted or uploaded the validator class is not called.

@Misco
Copy link

Misco commented Dec 23, 2022

Hello, could you find a solution? validateUpload is working but validator not at all.

@Misco
Copy link

Misco commented Mar 8, 2023

My Solution is for sure only a dirty Fix, but it works:

dca/tl_member.php einfach oben hinzufügen:

`
$GLOBALS['TL_DCA']['tl_member']['config']['onsubmit_callback'][] = array('Finalsteps', 'move');
class Finalsteps
{
protected $strTemporaryPath = 'system/tmp';
protected $strThumbnailPath = 'assets/images';
protected $strMemberPath = 'assets/avatars/pic0';

public function move(DataContainer $dc){
    
    $varInput = $_POST['avatar']; 

    // Delete the file
    $strAvatar = \Avatar::find($dc->id, $this->strMemberPath);
    if ($varInput == '') {
        \Files::getInstance()->delete($strAvatar);
    }
    
    // Move file to the destination folder
    if (is_file(TL_ROOT . '/' . $varInput) && $this->isTemporaryFile($varInput)) {  

        // Delete the current avatar
        if ($strAvatar != '') {
            \Files::getInstance()->delete($strAvatar);
        }

        $strNew = $this->strMemberPath . '/' . $dc->id . '-' . md5(uniqid('', true)) . '.' . pathinfo($varInput, PATHINFO_EXTENSION);

        if (\Files::getInstance()->rename($varInput, $strNew)) {
            $varReturn = $strNew;
        }
    }
}
protected function isTemporaryFile($strFile)
{
    if (stripos($strFile, $this->strThumbnailPath) !== false) {
        return true;
    }

    return stripos($strFile, $this->strTemporaryPath) !== false;
}

}
`

validator Funktion habe ich gelöscht aus AvatarWidgetBase.php

@xApep
Copy link

xApep commented Jun 8, 2023

Any official fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants