Page 1 of 1

Delete/Remove Image button doesn't work

Posted: 2020-12-28 15:13
by federico
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

Re: Delete/Remove Image button doesn't work

Posted: 2020-12-29 00:14
by dge
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!

Re: Delete/Remove Image button doesn't work

Posted: 2020-12-29 12:30
by pbottcher
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 !!

Re: Delete/Remove Image button doesn't work

Posted: 2020-12-29 13:13
by federico
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:

Re: Delete/Remove Image button doesn't work

Posted: 2021-03-16 08:04
by federico
Is there any possibility of an update after every months
tks

Re: Delete/Remove Image button doesn't work

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

Re: Delete/Remove Image button doesn't work

Posted: 2021-05-01 16:16
by a.gneady
I'm so sorry for the long delay. I've added this issue to our list of fixes for the next release.

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-09 06:47
by jsetzer
Hi,

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

Can anyone else confirm this?

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-19 06:43
by jsetzer
Can anyone confirm this issue or does it work for all of you in AppGini 5.97?

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-19 09:32
by jsetzer
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-26 11:06
by federico
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!

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-26 12:08
by jsetzer
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-26 17:19
by federico
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!

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-26 18:08
by jsetzer
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-27 06:39
by federico
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 :!:

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-28 17:47
by a.gneady
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?

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-29 01:14
by peebee
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-07-29 01:47
by peebee
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-08-27 08:42
by balfons
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-11 04:05
by peebee
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......

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-11 04:42
by peebee
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.

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-12 22:32
by a.gneady
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:

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-13 00:09
by a.gneady
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)

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-14 22:04
by peebee
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

Re: Delete/Remove Image button doesn't work

Posted: 2021-11-18 12:06
by a.gneady
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 7957 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.