accessing image from folder other than htdocs

Problems with the Windows version of XAMPP, questions, comments, and anything related.

accessing image from folder other than htdocs

Postby alexreborn » 18. August 2012 15:18

script is img src="../php/bin/abc.jpg"
abc.jpg is present there but image is not displayed...
what is the problem and what can be done to resolve it??????????
alexreborn
 
Posts: 4
Joined: 18. August 2012 15:08
Operating System: windows ultimate(32)

Re: accessing image from folder other than htdocs

Postby Altrea » 18. August 2012 20:06

Hi alexreborn (there is ALWAYS time for a short salutation, especially if you are asking for help on a community board. It's a matter of politeness),

alexreborn wrote:what is the problem and what can be done to resolve it??????????

Simple answer: Images will be requested by the client browser and you can't request files that are outside of the DocumentRoot.
Saving all asset files inside DocumentRoot which are needed to be requestable is the most common and recommend way.

What should be the sense of having images outside DocumentRoot?

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: accessing image from folder other than htdocs

Postby alexreborn » 19. August 2012 06:18

@ Altrea i knew dis.. bt sum1 told me dat it can be accessed and asked me to find it out....
anyways thankyou for your valuable tym and answer...
alexreborn
 
Posts: 4
Joined: 18. August 2012 15:08
Operating System: windows ultimate(32)

Re: accessing image from folder other than htdocs

Postby Altrea » 19. August 2012 09:22

alexreborn wrote:@ Altrea i knew dis.. bt sum1 told me dat it can be accessed and asked me to find it out....

Then that someone should tell you the URL to find it out yourself.

Sure, there are some ways to configure the Apache to make files in other directorys accessible (Alias, AliasMatch) or fetching the image with PHP.
But this is very uncommonfor most situations.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 105 guests