josegonzalez/upload — pull request #107 by joshuapaling (2013-03-04 10:06:29+00:00)
Title: Fix: Empty 'remove' field no longer deletes files

As you probably know:
- 'isset' returns true if a variable or array key is instantiated, false otherwise
- 'empty' returns true if a variable or array key is NOT instantiated, OR holds a value that evaluates to false.
(I'm sure you don't need it, but lots more explanation here: http://kunststube.net/isset/)

Previously, an 'isset' was used to determine if a 'remove' field existed, and if so, files were deleted. This meant that even an unchecked 'remove' checkbox in your form would delete the files.

I've changed the test to use '!empty', so that files will only be deteled if the 'remove' field a) exists in the array, and b) contains a value that doesn't evaluate to false.

So now you can include a 'remove' checkbox along with every upload field, and files will only be deleted when the user checks it.

Signed-off-by: Joshua Paling