Author Topic: (quetion) add username to file name at uplaod  (Read 5483 times)

0 Members and 1 Guest are viewing this topic.

Offline Flatermann

  • Newbie
  • *
  • Posts: 32
    • View Profile
(quetion) add username to file name at uplaod
« on: February 25, 2009, 02:19:01 PM »
Hello everyone .. hope someone can help. i use search but didnt find anything

My quetion is, can someone telle me what to chance that wenn a user uploads a pic (mypic.jp) it is saved on server as (username_mypic.jpg)
the idea is that when somthing happens, its is alway posible to see what pic was from what user

Hope someone can help me on this

Thank you and geats from Flatermann

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: (quetion) add username to file name at uplaod
« Reply #1 on: February 26, 2009, 03:01:36 AM »
Try this:
in includes/upload.php find two times:
      $this->name $regs[1];


Insert below each:
      global $user_info$lang;
      
$this->name .= "_".preg_replace("#[\\/:*?\"<>|]#""_", ($user_info['user_level'] == GUEST $lang['userlevel_guest'] : $user_info['user_name']))."[".$user_info['user_id']."]";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Flatermann

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: (quetion) add username to file name at uplaod
« Reply #2 on: February 26, 2009, 01:27:17 PM »
OMG works fine for admin... havto wait if normal reg users give a feedback if it works fine for them to.


Thank you very much.. you realy help on that on..


Greats Flatermann

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: (quetion) add username to file name at uplaod
« Reply #3 on: March 19, 2009, 09:42:47 AM »
Thanks,

Works very nice.  :D
www.globalfoto.net

Sintra - Portugal

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: (quetion) add username to file name at uplaod
« Reply #4 on: October 01, 2009, 11:13:54 AM »
Find a problem.

If a user use an accent in the username for example António,don't works.
www.globalfoto.net

Sintra - Portugal