Overwriting file on update form

Hey everyone,

I have an easy question I guess, which I am not able to figure out.

How can I overwrite a file (img) on an update form, so that the file is updated.

I went through the documentation on uploading file with server connect however there isn't any mention on updating files except for the overwrite check box that is available but I don't know how to use it?

I am storing the file url on upload on the create form but I don"t know how to update the file on an edit/update form.

Regards,

  1. Make a serveraction “update”
  2. Make the database connection
  3. Make a databasequery and name it “deleteimg”. In Query builder select the table to be updated, then select the column for the “Image”. Under conditions select id > equal > {{$_POST.id}}
    1_record

  1. New database query and name it update. In query builder select the table to be updated. Click OK. Check if all the POST variables have been added under Globals > Post

  1. Re-open the update query. In image Value select Globals > Post > Image > Name

Do the same for Condition

  1. Select DatabaseQuery Deleteimg and insert Condtion.
    As a condition select t Globals > Post > Image > Name

  2. Under then > steps do your upload steps
    5

  3. After you last save image add If File Exists. File Path should be something like /uploadimage/deleteimg[0].image from the deleteimg query

  4. Under then > Steps: add File Remover with the same parameters as in 8.

It took me a long time to figure this out for myself, but it works seamlessly for me now.

2 Likes

Thank you, that was harder than I expected.

After a tough struggle, finally I got it working

1 Like

You did it a lot quicker than I did :sweat_smile:
Glad I could be of help

2 Likes