1
X-Ception
Upload locations
  • 2006/9/8 8:36

  • X-Ception

  • Just popping in

  • Posts: 28

  • Since: 2005/2/28


I wish to change the upload location for smilets, as well as ranks to stop the clutter in the main root of /uploads/

i would like to use /uploads/smilies
and
/uploads/ranks

or similar, how would i define this correctly and retain security.

2
X-Ception
Re: Upload locations
  • 2006/9/9 17:28

  • X-Ception

  • Just popping in

  • Posts: 28

  • Since: 2005/2/28


anyone have any ideas, please.

3
McNaz
Re: Upload locations
  • 2006/9/9 21:51

  • McNaz

  • Just can't stay away

  • Posts: 574

  • Since: 2003/4/21


AFAIK you can't without hacking the XOOPS core, which is not advisable unless you really really know what you are doing.

4
X-Ception
Re: Upload locations
  • 2006/9/9 23:54

  • X-Ception

  • Just popping in

  • Posts: 28

  • Since: 2005/2/28


yup knew it would be a case of that, just after the modifications tho.

5
Peekay
Re: Upload locations
  • 2006/9/10 0:00

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Quote:

X-Ception wrote:
I wish to change the upload location for smilets, as well as ranks to stop the clutter in the main root of /uploads/

I agree with your observation. If module developers create folders in 'uploads' it makes it easy for administrators to add, edit or delete files using a file manager utility. However at present the uploads root is like a teenager's bedroom.

Xoops!... go tidy your room.
A thread is for life. Not just for Christmas.

6
X-Ception
Re: Upload locations
  • 2006/9/17 23:55

  • X-Ception

  • Just popping in

  • Posts: 28

  • Since: 2005/2/28


I have an idea how to do this, but i dont wish to mod the core blindly, anyone got any ideas ? please

7
rplima2004
Re: Upload locations
  • 2006/9/18 1:55

  • rplima2004

  • Just popping in

  • Posts: 70

  • Since: 2004/10/8


Hi X-Ception,

Really this is very simple. First make a backup of the file module/system/admin/smilies/main.php

Open the file and look at line 64 or search for
case "SmilesAdd":

In the upload code, change the line:
Quote:

$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);


for:
Quote:

$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH.'/smile', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);


and the line:
Quote:

$smile_url = $uploader->getSavedFileName();


for:
Quote:

$smile_url = 'smile/'.$uploader->getSavedFileName();


Now, on the line 106 (case "SmilesSave":)
Change the upload area again
Quote:

$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);


for:
Quote:

$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH.'/smile', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);


and the line:
Quote:

$smile_url = $uploader->getSavedFileName();


for:
Quote:

$smile_url = 'smile/'.$uploader->getSavedFileName();


Save the file. Now, create the folder uploads/smile and change the write permissions. (chmod 777).
Move all smilies files to the new folder and change in the table prefix_smiles the field smile_url. Only add the smile/ before the name of the file for all the smilies.

Done. Now, all new smile will be saved in the new folder and normally shown in your site.

Hope it helps

TheRplima

8
rplima2004
Re: Upload locations
  • 2006/9/18 2:06

  • rplima2004

  • Just popping in

  • Posts: 70

  • Since: 2004/10/8


Sorry, I forgot to speak about ranks. The idea is the same of the smile. Only open the file module/system/admin/userrank/main.php and make the changes in the upload code as you made with smiles.

Quote:

$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH.'/ranks', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);


Quote:

$rank_image = 'ranks/'.$uploader->getSavedFileName();



TheRplima

9
X-Ception
Re: Upload locations
  • 2006/9/18 8:44

  • X-Ception

  • Just popping in

  • Posts: 28

  • Since: 2005/2/28


Thank you TheRplima - most helpful

Login

Who's Online

326 user(s) are online (247 user(s) are browsing Support Forums)


Members: 0


Guests: 326


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits