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

Reset Uploader to main directory
https://www.tinywebgallery.com/forum/viewtopic.php?f=13&t=3034
Page 1 of 1

Author:  tcarr170 [ 17. Jun 2011, 14:37 ]
Post subject:  Reset Uploader to main directory

Hi Michael,

Is there a way to reset or reload the Uploader so that it moves back up to the main directory after a folder is deleted inside a deeper folder?

Brief explanation of what I'm doing ...

My images are loaded into folders by the Country in which they were photographed.
The Country folder is automatically created according to the country name selected in a drop down menu when the user uploads the image.
I also have my thumbnails automatically placed inside that country folder.

I have created an "_after_process_file" plugin (which you already helped me with) that deletes the thumbnails inside the country folder if a user deletes an image.
Then the plugin checks to see if that thumbnails folder and country folder are empty, if yes, then it deletes both the thumbnails folder and the country folder. This way I wont have a lot of empty country folders if the user is deleting images.
When the country folder is automatically deleted, I get the status message "The remote folder does not exist or was removed." which I understand, because the user is still inside that directory.

What I need to do, is after that folder is automatically deleted, is to have the Uploader reset or move back up to the starting directory, so the user is not confused. I want them to be automatically taken back to the starting point.

Does this make sense? I explored some of the functions in the tfu_helper and tfu_file. I found "resetSessionTree()" and "change_folder" functions, but was not successful in doing anything with them.

Any suggestions would be greatly appreciated! :)

Tracy

Joomla 1.6.3
JFU 2.14
Server: localhost / development site

Author:  TinyWebGallery [ 17. Jun 2011, 15:10 ]
Post subject:  Re: Reset Uploader to main directory

This does not help.

if you delete a directory with the flash I go one step higher. Do you want to do this or to the main directory the user initaly started?

If you delete a file you would have to set the working dir to the main dir. The main user dir and the current dir is stored in the session. So it is no problem to set the directory you like (even in the plugin).

the main dir is $_SESSION["TFU_ROOT_DIR"]
the current: $_SESSION["TFU_DIR"]

- Michael

Author:  tcarr170 [ 17. Jun 2011, 19:11 ]
Post subject:  Re: Reset Uploader to main directory

Hi Michael, I want them to be returned to the main directory the user initially started in (which is the top of their user directory).

I have a function in my plugin which removes the Country folder if there are no more images left in there. It is at that point I want to return them to the top directory.

So my function reads:

if ($removeFolders) { // next reset working directory back to top?

??? then what code goes here to reset session to: $_SESSION["TFU_ROOT_DIR"];

}

Thanks!
Tracy

Author:  TinyWebGallery [ 17. Jun 2011, 19:12 ]
Post subject:  Re: Reset Uploader to main directory

$_SESSION["TFU_DIR"] = $_SESSION["TFU_ROOT_DIR"];

Author:  tcarr170 [ 17. Jun 2011, 19:38 ]
Post subject:  Re: Reset Uploader to main directory

Yay! You are the best! Thanks :D

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