Forums

Delete / Change an image file

Fredolino 18 Jan, 2016
Hi,

I have an edit form where I can change data in the database.
It is a CF5 form that works on CC5.
The form works correctly for text. Unfortunately I can not delete / change an image.
I have a FileField named "Resume [foto]."
In Setup from the File Conig-feld: "Resume: jpg"
(Resume is the model name in CC5)

What can I do?

F.
Fredolino 19 Jan, 2016
:-)
ok,
but what is "Add a 'delete_image' checkbox element"?
GreyHead 19 Jan, 2016
Hi Fredelino,

If you need it - a checkbox that the user can tick to show that an image should be deleted.

Bob
Fredolino 20 Jan, 2016
Hi,
something I'm still wrong.
If a photo has been uploaded on the entry form, then it appears to me right in my overview.
In my edit form (CF5 / CC5) It should also be displayed, but here I only the "no_image.jpg" appears.
This code is probably the error:
 
<?php
if ( isset($form->Resume['foto']) && $form->Resume['foto'] ) {
  echo "<img src='".JURI::root()."components/com_chronoforms5/chronoforms/uploads/Bewerbungen/{Resume.foto}' style='max-width:180px' />";
} else {
  echo "<img src='".JURI::root()."components/com_chronoforms5/chronoforms/uploads/Bewerbungen/no_image.jpg' style='max-width:180px' />";
}
?> 


When I use this code, then angeigt me in the Edit form that correctly uploaded image, what I want to change the Edit Form:
<img src='/components/com_chronoforms5/chronoforms/uploads/Bewerbungen/{Resume.foto}' /> 


If everything is working properly, then I also want to delete, replace, or upload a new photo image.

For this purpose, I have read the FAQ and also this interesting article:
http://www.chronoengine.com/forums/posts/f2/t100189/updating-an-image.html?hilit=Ghost+value

Deshalb habe ich eine Checkbox Group mit den Einstellungen:

Field Name: delete_image
Options: delete=Löschen?
and On Event (screen)

in Setup this Code:

<?php
if  ( isset($form->data['delete_image']) && $form->data['delete_image'] == 'delete' ) {
 $form->data['foto'] = '';
}
?>
This topic is locked and no more replies can be posted.