How can I delete a single file Upload in Editor
How can I delete a single file Upload in Editor
acampo
Posts: 3Questions: 2Answers: 0
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
This discussion has been closed.
Answers
The
clearText
option of theupload
field type needs to be used to have it show a clear button.Allan
Ohh my good. So easy :-))
thx