Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-23-2007, 08:25 PM   PM User | #1
Nightchild
New Coder

 
Join Date: Jun 2007
Location: Canada
Posts: 49
Thanks: 1
Thanked 1 Time in 1 Post
Nightchild is an unknown quantity at this point
View but not browse uploaded files

On a shared server over which I have no configuration control...

Can PHP upload files (pic, pdf, doc...) to a folder outside/above the web root but then make them available for display in a browser via links?

/my_root
/email
/uploaded_files <--- put files here
/www <--- my html and php are in here
If so, how would I generate the links? I have tried reading the directory and creating file links with the full path (example: /server/user/my_root/uploaded_files/pic.jpg) but this doesn't work.
Nightchild is offline   Reply With Quote
Old 07-23-2007, 08:35 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Give us a link to the page that is displaying the links.
(even though they're wrong).

I'm thinking it will be like:

<img src="../uploaded_files/pic.jpg" alt="" />

But, if we can see your web page, we'd know.
mlseim is offline   Reply With Quote
Old 07-23-2007, 10:26 PM   PM User | #3
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,712
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
URL's for images/links... must point to http/https accessible locations. File system locations above your web document folder are not accessible through http/https requests. Likewise, things like absolute file system paths have no meaning in URL's. Remember that URL's are relative to your web document folder.

You would need to write a .php script and put it in your web space that is the target of a link that is associated with a file. The .php script would then open and read the file from the folder above your web document folder and output any necessary headers/file contents to the browser.
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.
CFMaBiSmAd is offline   Reply With Quote
Old 07-23-2007, 11:19 PM   PM User | #4
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
I guess I totally missed what he was asking.
mlseim is offline   Reply With Quote
Old 07-24-2007, 12:05 PM   PM User | #5
Nightchild
New Coder

 
Join Date: Jun 2007
Location: Canada
Posts: 49
Thanks: 1
Thanked 1 Time in 1 Post
Nightchild is an unknown quantity at this point
Thanks... that is what I thought.
Nightchild is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:23 PM.


Advertisement
Log in to turn off these ads.