How can I delete a single file Upload in Editor

How can I delete a single file Upload in Editor

acampoacampo Posts: 3Questions: 2Answers: 0
edited July 2017 in Free community support

Hi

Can anybody help me ?

`{
        label: "PDF:",
        name: "pdf",
        type: "upload",
        display: function ( pdf ) {
            if(pdf !== null){
                var extension = pdf.split('.');
                extension = extension[extension.length - 1];
                if(extension === 'pdf'){
                    return '<a href="/uploads/'+pdf+'" target="_blank"><img class="preview" src="/uploads/thumbs/'+pdf+'.png"/></a>';
                }else{
                    return '<a href="/uploads/'+pdf+'" target="_blank"><img class="preview" src="/uploads/'+pdf+'"/></a>';
                }
            }else{
                return '--';
            }

        },
        noImageText: 'Keine Datei'
    }
`

Server:

`
$editor = Editor::inst( $db, 'formen' )
    ->fields(
        Field::inst( 'id' ),
        Field::inst( 'kunde' ),
        Field::inst( 'auftragsnr' ),
        Field::inst( 'beschreibung' ),
        Field::inst( 'besonderheit' ),
        Field::inst( 'bemerkung' ),
        Field::inst( 'nutzen' ),
        Field::inst( 'groesse' ),
        Field::inst( 'wolfnr' ),
        Field::inst( 'pdf' )
            ->upload( Upload::inst( '__NAME__' ) )
            ->setFormatter( 'Format::nullEmpty' ),
        Field::inst( 'schrank' ),
        Field::inst( 'regal' )
    )

    ->process( $_POST )
    ->json();
`

There is no button for deleting

Answers

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    The clearText option of the upload field type needs to be used to have it show a clear button.

    Allan

  • acampoacampo Posts: 3Questions: 2Answers: 0

    Ohh my good. So easy :-))

    thx

This discussion has been closed.