Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

File deleting problem.
https://www.tinywebgallery.com/forum/viewtopic.php?f=12&t=3062
Page 1 of 1

Author:  lior [ 18. Jul 2011, 13:51 ]
Post subject:  File deleting problem.

Hello,

I'm using TFU 2.14.2 to upload files to TWG webgalley.
I've made some changes when the user uploads a file.
I added a function that check if the files are images, if not it create a 80X80 transparent image and put on it the icon for the specific file and add the file name to this image.
Also, when the user opens a folder in the TFU he doesn't see the images if it's the added images, he sees only the files he uploaded.
This I've done with a function that checks if in folder there is 2 files with the same name, without the extinsion, and if true the filename.png will added to the $exclude_directories.

Ok, now this is working very good for me, but now I have a problem to delete files, when i delete file or files the action is done for the wrong file.
If for example I delete the fourth file in the folder from the TFU, the delete action is done for the fourth file on the server, this 2 file are not the same cause the TFU has some hidden files.
It looks like the delete action is done not by the file name but by the file location in the folder.

I tried to solve it by my self but I just couldn't.
Does someone have any suggestion how to solve it??

Thanks in advance.
Lior Franko

Author:  TinyWebGallery [ 18. Jul 2011, 14:55 ]
Post subject:  Re: File deleting problem.

Deletion goes per location because this solves all encoding problems.
So the real problem is that TFU does not see your files.

When do you create them? in a plugin?
When you change a folder the file list should be reloaded and you files are then available as well.

- Michael

Author:  lior [ 24. Jul 2011, 10:50 ]
Post subject:  Re: File deleting problem.

Yes I've created a pulgin that's create the additional images after the upload.

I'm checking now a way to sort the files in a way that all the unnecessary files will listed last and then the "delete by location won't have a problem, does any one have a good idea how to do it?

Thank you,

Author:  TinyWebGallery [ 24. Jul 2011, 12:36 ]
Post subject:  Re: File deleting problem.

the files are not the problem. The problem is that they seem not to be visible in the flash but in php and then there is a mismatch. Have you excluded the files you have created somehow?

Author:  lior [ 24. Jul 2011, 13:29 ]
Post subject:  Re: File deleting problem.

$files_list = getDirectoryList($dir);
$withoutExt = preg_replace("/\\.[^.\\s]{3,4}$/", "", $files_list);
$duplicates = array_duplicates($withoutExt);
$withoutExt = array_unique($withoutExt);
foreach($withoutExt as $k=>$v){
array_push($exclude_directories, $v.".png");
}

I added this lines in the tfu_file.php before the read_dir part.

Author:  TinyWebGallery [ 24. Jul 2011, 20:44 ]
Post subject:  Re: File deleting problem.

This is the problem - you only changed the exclude_directory for the listing itself but not fir the deletion.
Move this part that is is done for the deletion action and the read dir action.

- Michael

Author:  lior [ 25. Jul 2011, 17:40 ]
Post subject:  Re: File deleting problem.

I'm sorry to bug I didn't understand where to move it.
It's located now between the lines:
clearstatcache();
and:
$size = read_dir($dir, $myFiles, $myDirs, $fix_utf8, $exclude_directories, $sort_files_by_date, $sort_directores_by_date);

Thank you,

Author:  TinyWebGallery [ 25. Jul 2011, 17:47 ]
Post subject:  Re: File deleting problem.

no - after

$action = parseInputParameter($_GET['action']);

it has to be done for the delete and the dir action.

does $forbidden_view_file_filter not work for you? There you can use any pattern valid for "fnmatch"


- Michael

Author:  lior [ 25. Jul 2011, 18:10 ]
Post subject:  Re: File deleting problem.

I changed it and it works!
Thank you!!

The $forbidden_view_file_filter is working also but I want to hide the *.png only in some folders not all.
Is there a way to add this parameter per folder? like the config file in the web galley.

Thank you!!!

Author:  TinyWebGallery [ 25. Jul 2011, 22:48 ]
Post subject:  Re: File deleting problem.

No - there is not per folder config.

- Michael

Author:  lior [ 26. Jul 2011, 09:11 ]
Post subject:  Re: File deleting problem.

Ok,

Thank you for your help.
I'll work with the excluded_files.

Thanks again.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/