Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 20. Apr 2024, 00:01

This forum is readonly now. Please use the new forum if you don't find the answer to your question here. The new forum is at https://www.tinywebgallery.com/blog/forum/


All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 21. May 2009, 01:18 
Offline

Joined: 21. May 2009, 01:08
Posts: 11
Hello,

I have seen it is possible to have an email generated which specifies the User and files that have just been uploaded, but is this information logged in a database somewhere? If not, is it possible to set this up?

It would be ideal for the Username, file name(s), filepath, and date to be recorded to a table in the Joomla database whenever an upload occurs. Please let me know if this is possible, as this would be a very useful feature!

Thanks,

Frank


Top
 Profile  
 
 Post subject:
PostPosted: 21. May 2009, 01:38 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Hi,

This is not problem at all. You have this information in tfu_upload already. Feel free to write it to a database.

It might be a nice feature for one of the next version - But currently JFU 2.9 has to be released officially first.

And then WFU (Wordpress Flash Uploader) is the next thing I want to finish first.

But if you don't have the time to do this by yourself please contact me by e-mail. I think we can figure something out ;).

- Michael


Top
 Profile  
 
 Post subject: tfu_upload for JFU?
PostPosted: 21. May 2009, 02:01 
Offline

Joined: 21. May 2009, 01:08
Posts: 11
Hi Michael,

You mentioned these parameters are available in tfu_upload. As I am using JFU, I did not see anything labeled tfu_upload.php in the [root]/components/com_joomla_flash_uploader directory. I did see joomla_flash_uploader.php? Can I find what I'm looking for in there?

Thanks,

Frank


Top
 Profile  
 
 Post subject:
PostPosted: 21. May 2009, 02:11 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
tfu subfolder! This is the stuff which does not use any Joomla code.

- Michael


Top
 Profile  
 
 Post subject: Not Writing to Database
PostPosted: 21. May 2009, 20:15 
Offline

Joined: 21. May 2009, 01:08
Posts: 11
Hi Michael,

In the tfu_upload.php I have entered the following code directly underneath the "//end of email section" (line 178). My code begins on line 180, ends on 201.

Code:
// Upload History section: This writes the details of an upload to a database table.
   $cxn_joom = mysql_connect("[host]","[user]","[password]") or die ("No dice.");
   $db_joom = mysql_select_db("[dbname]");
   $dateupload = date("m/d/Y");
   $filestr = "\n\n";
   
   foreach ($_SESSION['TFU_LAST_UPLOADS'] as $filename) {
   if ($upload_notification_use_full_path) {
     $filestr = $filestr . tfu_urlencode(fixUrl(getRootUrl() . $path_fix . $filename)) . "\n";
   } else { 
     $filestr = $filestr . str_replace('./', '', str_replace('../', '', $filename)) . "\n";
   }
   }
   if ($filestr == "\n\n") {
      $filestr .= 'Please check your setup. No files where uploaded.';
   }
   $username = (isset($_SESSION['TFU_USER'])) ? $_SESSION['TFU_USER'] : $_SERVER['REMOTE_ADDR']; // if we don't have a use we use the IP
   $insertFields = "INSERT INTO jos_flashupload_historylog (uploadDate, uploadUser, file) VALUES (" . $dateUpload . "," . $username . "," . $filestr . ");";
   $update_log = mysql_query($insertFields,$cxn_joom) or die ("Couldn't execute query.");
// end of Upload History section


Table info for jos_flashupload_historylog :
Image

id int(10) UNSIGNED auto_increment
uploadDate varchar(30) utf8_general_ci
uploadUser varchar(45) utf8_general_ci
file varchar(255) utf8_general_ci

Naturally, I have replaced the bracketed items in the mysql connection function with my host info. I am using PHP 5 and MySQL 4.1. I am not yet a registered user, but I certainly will become one if I can get this script working (I will definitely need the upload size restriction lifted). Any ideas as to why this is not working? I greatly appreciate any insight you might have.

Thanks,

Frank


Top
 Profile  
 
 Post subject:
PostPosted: 22. May 2009, 01:35 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
is your code executed? you can use the function

debug();

which prints everything to tfu.log.

- Michael


Top
 Profile  
 
PostPosted: 22. May 2009, 09:41 
Offline

Joined: 21. May 2009, 01:08
Posts: 11
Good tip on the debug function, Michael. After fixing some syntax errors in my SQL insert statement, and a few other minor issues, the upload details are now being written to a table I setup in the Joomla database. I adjusted the foreach loop so each file (if multiple files are uploaded at the same time) will get its own record in the table. I have not tested the code below too much, but it seems to be working so far. Thanks again for your help with this.

Code:
// Upload History section: This writes the details of an upload to a database table.
   $cxn_joom = mysql_connect("[host]","[user]","[password]") or die ("No dice.");
   $db_joom = mysql_select_db("[database]");
   
   $dateupload = date("m/d/Y");
   $filestr = "\n\n";
   
   foreach ($_SESSION['TFU_LAST_UPLOADS'] as $filename) {
   if ($upload_notification_use_full_path) {
     $filestr = tfu_urlencode(fixUrl(getRootUrl() . $path_fix . $filename));
   } else { 
     $filestr = str_replace('./', '', str_replace('../', '', $filename));
   }
   }
   if ($filestr == "\n\n") {
      $filestr .= 'Please check your setup. No files where uploaded.';
   }
   $username = (isset($_SESSION['TFU_USER'])) ? $_SESSION['TFU_USER'] : $_SERVER['REMOTE_ADDR']; // if we don't have a use we use the IP
   
   $insertFields = "INSERT INTO jos_flashupload_historylog (uploadDate,uploadUser,fileName) VALUES (" ."'" . $dateupload . "'" . "," . "'" . $username . "'" . "," . "'" . $filestr . "'" . ")";
   $update_log = mysql_query($insertFields,$cxn_joom) or die ("Couldn't execute query.");
// end of Upload History section.


Top
 Profile  
 
PostPosted: 29. May 2009, 02:29 
Offline

Joined: 21. May 2009, 01:08
Posts: 11
Hi Michael,

In the code example of my previous post, the username is captured. Could you please post some code for how I can simply get the user ID instead? The user id is just a two or 3 digit number assigned by joomla, but I cannot figure out how to capture it.

I would very much appreciate a line or two of code if you can do so easily, as I have tried many things and haven't been able to get it yet.

Thanks,

Frank


Top
 Profile  
 
 Post subject:
PostPosted: 29. May 2009, 08:34 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
You would have to add this to the session on the joomla wrapper side.

Search where TFU_USER is set and set your id löike that.

- Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
powered by phpbb | Datenschutz/ Privacy policy