Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] [HOW TO] direct access to uploaded files

[SOLVED] [HOW TO] direct access to uploaded files 12 Dec 2012 13:37 #6029

  • mfr75
  • mfr75's Avatar
  • Offline
  • New Member
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
Hello,
I would like to know a method in order to have direct acces in frontend to images uploaded from backend. so that browser could cache these images for beter performance.
unfortunately when i do this in my front end views a get a 403 with a forbidden access.
any suggestion for a way of hacking it ?

thanks a lot.
The administrator has disabled public write access.

Re: direct access to uploaded files 13 Dec 2012 07:49 #6036

  • mfr75
  • mfr75's Avatar
  • Offline
  • New Member
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
I found the solution :
in the file administrator/components/com_yourcomp/classes/upload.php
in the line 106 :
                //Protect against execution and set writable
		@chmod($uploadPath, YOURCOMP_UPLOAD_CHMOD_FOLDER);
just comment the chmod line so that it will not change folder permission on the path where your files are.
if you have already upload files to your path before making this change.
just do a chmod 755 to your path

++
Last Edit: 13 Dec 2012 07:49 by mfr75.
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: direct access to uploaded files 13 Dec 2012 08:33 #6037

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Nice! @mfr75!

I'd made a point of coming to this post today to point you at the upload class but you got there yourself first!

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: direct access to uploaded files 13 Dec 2012 10:58 #6042

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Good.
just comment the chmod line so that it will not change folder permission on the path where your files are.
if you have already upload files to your path before making this change.
just do a chmod 755 to your path

You can also do it propertly, not commenting, but changing the chmod for something else specific : ex : 755.
Define it in constants, or create a new constant.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy
Time to create page: 0.151 seconds

Get Started