Delete/Remove Image button doesn't work

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Delete/Remove Image button doesn't work

Post by federico » 2020-12-28 15:13

Hi All and Merry Christmas!

On a photo record if I try to delete the picture which I recently upload, it doesn't work. I can just replace the image with another one. Am I wrong?
App Gini version 5.92 1126

tks
Federico
Attachments
Cattura.JPG
Cattura.JPG (57.21 KiB) Viewed 10941 times

dge
Posts: 25
Joined: 2013-12-05 02:54

Re: Delete/Remove Image button doesn't work

Post by dge » 2020-12-29 00:14

Yes, I found the same issue today in 5.92. Remove image (or pdf), save, but it's still there. No way to remove it!

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Delete/Remove Image button doesn't work

Post by pbottcher » 2020-12-29 12:30

Hi,

it looks like the remove code is not being generated.

What you can try:

Go to the TABLENAME_dml.php file and look for the

TABLENAMEfunction basetable_update(&$selected_id, &$error_message = '') {

You should see a definition of the data array
Something like:

Code: Select all

$data = [ 
Now look for the

'FIELDNAME' => Request::fileUpload('FIELDNAME', [

and add before the

Code: Select all

			'success' => function($name, $selected_id) {
the following:

Code: Select all

			'removeOnRequest' => true,
			'remove' => function($selected_id) {
				// delete old file from server
				$oldFile = existing_value('basetable', 'bild', $selected_id);
				if(!$oldFile) return;
				foreach (["","_tv","_dv"] as $key=>$ext) {
					@unlink(getUploadDir('') . pathinfo($oldFile,PATHINFO_FILENAME).$ext.".".pathinfo($oldFile,PATHINFO_EXTENSION));	
				}
			},
TABLENAME and FIELDNAME need to be adjusted to your needs.

!! NOTE that this file will be overwritten once you recreate you project, so you will need to redo that changes !!
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2020-12-29 13:13

thanks for your support. This helps for a while. I guess this will be fixed with the next update... I have many of them to fix now, so I'd prefer to wait for an update ;) till my colleagues can wait too :lol:

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2021-03-16 08:04

Is there any possibility of an update after every months
tks

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2021-03-19 09:05

federico wrote:
2021-03-16 08:04
Is there any possibility of an update after every months
tks
sorry... 3 months :lol:

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Delete/Remove Image button doesn't work

Post by a.gneady » 2021-05-01 16:16

I'm so sorry for the long delay. I've added this issue to our list of fixes for the next release.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Delete/Remove Image button doesn't work

Post by jsetzer » 2021-07-09 06:47

Hi,

I've tested deleting images in 5.97 due to customer's complaints :( but it still seems broken.

Can anyone else confirm this?
Attachments
OcaG9FF9wD.gif
OcaG9FF9wD.gif (120.27 KiB) Viewed 9382 times
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Delete/Remove Image button doesn't work

Post by jsetzer » 2021-07-19 06:43

Can anyone confirm this issue or does it work for all of you in AppGini 5.97?
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Delete/Remove Image button doesn't work

Post by jsetzer » 2021-07-19 09:32

If anyone else has this problem: Here is a ("Vanilla"*) hook-only interim workaround:
https://appgini.bizzworxx.de/appgini/so ... gini-5-8x/

That article contains reusable copy & paste code for hooks/__global.php and for hooks/TABLENAME.php. The reusable global code has to be pasted into __global.php once. The table-dependent code has to be pasted into every table-related hook-file which contains image-upload fields.

Hope this is helpful for someone else.

* That code does not need any additional library but works on pure AppGini generated code.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2021-07-26 11:06

Hello Jan

Sorry for the long delay. I still have the problem and I had a look to your work. I'll try to apply it, but this is a workaround. The fix shoul be done by AppGini... I have now to change any table and in the future add this code. It's realy frustrating!

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Delete/Remove Image button doesn't work

Post by jsetzer » 2021-07-26 12:08

but this is a workaround
Yes, it is a free working workaound.
The fix shoul be done by AppGini
Yes, the fix should be applied to AppGini itself.
It's realy frustrating!
For me, it's important that I can give my clients a solution that works, even if it costs me an hour or two of extra work that I don't get paid for. In the given situation we can keep complaining or we, as a community, can try to improve using hooks-solutions as good as we can and help each other. I am happy about everyone who contributes here in the forum with their help and solid, working solutions.

Just try with the code I have published above. This should solve the problem for the moment and it is only little work for you.

PS: Ahmed (BigProf) has much to do with improving the generated code and with re-designing internals for better future maintainability targeting AG v6.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2021-07-26 17:19

Thank you Jan
Of course your precious time is much appreciated in this forum.
I don't want to criticize but I read many times in other posts that there are many improovments waiting for a real application after a couple of years. AppGini remains a great idea and I guess to see many new features with the version 6

Have a great work!

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Delete/Remove Image button doesn't work

Post by jsetzer » 2021-07-26 18:08

THIS IS JUST MY PERSONAL OPINION

Well, I think these are two different stories:

Bugs vs Feature Requests

We all have purchased a fixed set of features for a fixed price. Noone has promised to us that, for the same price we have paid once, there will be every new feature someone wishes. No company can promise this. It was our personal decision to buy that tool. We were able to read the docs before and we have decided for the given feature set. It was OUR decision.

BUGS

Real software BUGS, related to the promised features we have paid for, have to be fixed, obviously. And I agree, sometimes I'd like to get the patches faster. But that's life. We know it from big companies, too. Fortunately this specific software AppGini provides so many hook functions and many guys in this community are giving a lot, not only taking. This means we CAN solve problems by ourselves and don't have to wait for Microsoft or SAP.

IMPROVEMENTS

Whereas improvements most of the time are just feature requests (wishes) of one or more users. Sometimes it reads very demanding and sometimes I wonder if those, who start getting angry, have realized at all that they have explicitly decided for a GIVEN feature set at a certain, fixed price in the past. Imagine you buy a Volkswagen car and then every year you demand all the new features of a brand new Tesla or Porsche and ask Volkswagen to deliver a new car for free every year having all new features. No company can fulfill that. When buying a car, it's clear: we get a certain feature set at a certain price. Somehow, when buying a software there seem to be different rules/expectations and a few still think they can get more and more without paying for. A few even seem to think development will get faster the louder they shout, or the more unpolite forum articles they post, all having the same, demanding subject.

I'm happy Ahmed keeps the lane and improves the software wisely. I'm glad not every feature request finds it's way into a follow up release, because in long term this would make AG more expensive and some feature requests are not helpful for most of us but only to very few.

My personal wish: fixing a real bug should have high priority. And if there is an announcement, a certain bug will be fixed with next release, it should be fixed with the next release. This would make it planable. And I can give a perspective to my customers. They can live with a bug if they know it will be fixed with next release. And if there is a workaround, they are happy immediately.

THIS WAS JUST MY PERSONAL OPINION. Everyone is free to read it or skip it and/or to write her/his own.

Keep going, Ahmed, I'm pretty sure there are many many silent readers who are following you and your decisions and are happy with such a smart tool saving months of working time per project.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Delete/Remove Image button doesn't work

Post by federico » 2021-07-27 06:39

Jan
Totaly agree with you. New features could be done or not, paied or not... decision of the software house.

However I created this post as a bug at the end of last year with 5.92 1126 and after 5 releases it has not been fixed yet. thank you again for your time, really but, it's just my personal opinion of a user which bought a car with a window that remains open and the meccanic suggests me to hold it with my hand to liftup everytime I open it. :lol:

Anyway when you, Ahmad and someone else will make a fusion of your software house I'm quite sure you'll get more and more success together :!:

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Delete/Remove Image button doesn't work

Post by a.gneady » 2021-07-28 17:47

Hmm ... I tried reproducing this issue in the demo Northwind app as generated by AppGini 5.97 but wasn't able to :roll:

Here is a short recording showing an image successfully being removed: https://screencast-o-matic.com/watch/criub5Vid9n
Am I missing something? Is it possible to send me a sample AXP project where this is not working?
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Delete/Remove Image button doesn't work

Post by peebee » 2021-07-29 01:14

Hmmm? Updated to Appgini 5.97 Revision 1142 and I too can confirm that I am experiencing the same issue of images not being deleted on Save? Hadn't noticed until I read this thread.

Multiple image upload fields in multiple tables and none are deleting. Absolute standard image upload fields that I've created many times.

Generated another simple app - same result.

And yes, I can confirm that Jan's very simple and elegant hooks code does solve the problem. Much appreciated and thanks Jan.

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Delete/Remove Image button doesn't work

Post by peebee » 2021-07-29 01:47

Ahmad, for testing purposes, please find the link below to a simple test app and AXP file

It contains one table with two fields (id and image). Zero edits.

I've tested it on a remote web server. It works other than uploaded images are failing to delete on Save.

I've included the AXP file and all Appgini generated files in the zip

https://drive.google.com/file/d/1o9rOnk ... sp=sharing

Thanks for your follow up.

PS: Hope the Drive link works OK? I tried to upload as an attachment but file was too large.

balfons
Veteran Member
Posts: 91
Joined: 2018-10-22 15:27

Re: Delete/Remove Image button doesn't work

Post by balfons » 2021-08-27 08:42

Good morning,

I found this post when trying to solve a problem deleting uploaded files. I'm also using Appgini version 5.97 revision 1142. I tried the workaround suggested by Jan (https://appgini.bizzworxx.de/appgini/so ... gini-5-8x/) just in one table (the most important) and it works right.

Thanks Jan and all contributors to the post, I'll also wait for the bug fixing in next AppGini version.

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Delete/Remove Image button doesn't work

Post by peebee » 2021-11-11 04:05

Would appear that this fail to "remove image on Save" bug is still present in V5.98?

Created a new test database in V5.98. 1 x table, 3 fields and zero edits.

Result: https://www.loom.com/share/b989ebf2a006 ... 662e7e98b3

And sadly, looks as though Jan's simple fix does not rectify the issue in V5.98.

Will take a look myself when time permits. Still trying to work out what's going on with the dates in V5.98......

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Delete/Remove Image button doesn't work

Post by peebee » 2021-11-11 04:42

Sincere apologies Jan - your simple fix DOES work with V5.98. It's my typing that doesn't work. Thanks yet again.

Mind you - I would have hoped/expected this issue to be fixed in the latest V5.98 which looking into the generated file differences, appears to be a major rebuild.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Delete/Remove Image button doesn't work

Post by a.gneady » 2021-11-12 22:32

OK, I'm investigating this issue thoroughly now ... I haven't been able to reproduce it but I'm clearly missing something since many users are reporting it .. So I'll dive deeper into this and make a fix for it. Apologies everybody for that :roll:
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Delete/Remove Image button doesn't work

Post by a.gneady » 2021-11-13 00:09

So, I tested this thoroughly under PHP 7.0, 7.1, ... till 8.1 and it works fine on my side on all versions: https://cdn.bigprof.com/screencasts/app ... -image.mp4

The code for handling file removal can be found in resources/lib/Request.php in the fileUpload() method .. specifically lines 79-89. This code is triggered by a call to Request::fileUpload() that should exist in tablename_update() function in the generated tablename_dml.php file (where tablename is the name of the table containing the image upload field)

I'm mentioning all the above details to: 1. Check that code similar to this exists in your generated app, and 2. To trace the execution on your side if you want ... I can check the code if anyone sends me the above mentioned 2 files (Request.php and tablename_dml.php)
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Delete/Remove Image button doesn't work

Post by peebee » 2021-11-14 22:04

Here you go Ahmed - 2 x files attached.

A simple vanilla 1 x table and 3 x fields app with zero edits. Remove images not working.

---------------------------------------------------------------------------------------
Server architecture Linux 3.10.0-962.3.2.lve1.5.61.el7.x86_64 x86_64
Web server LiteSpeed
PHP version 7.4.25 (Supports 64bit values)
PHP SAPI litespeed
PHP max input variables 3000
PHP time limit 300
PHP memory limit 256M
Max input time 120
Upload max filesize 64M
PHP post max size 64M
cURL version 7.71.0 OpenSSL/1.1.1d
MySQL: 10.3.32-MariaDB
Attachments
Remove-Image-5.98.zip
(7.25 KiB) Downloaded 142 times

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Delete/Remove Image button doesn't work

Post by a.gneady » 2021-11-18 12:06

Thanks for the files. I checked them and Request.php is fine, but the dml file doesn't contain the code for handling file removal request. I tried tracing this and found that in order for the file removal handling code to be included in the dml, the image field should meet 2 conditions:

1. The option "Delete files from server when removed from record" is enabled:
delete-image-option.png
delete-image-option.png (13.53 KiB) Viewed 7934 times

2. The field is not set as "Required" (if the field is required, then you can't empty it by removing the image file without uploading another one)

Now, I realize that the "Remove file" checkbox shouldn't be present if the above 2 conditions are not met as this would confuse users. So, I'll work on fixing this.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply