Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Problem opening directory using opendir
Old 02-01-2011, 07:00 AM Problem opening directory using opendir
Skilled Talker

Posts: 50
Trades: 0
Using the following code produces the error:

opendir(/images) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory in <b>/Applications/MAMP/htdocs/domain.co.uk/links.php</b> on line <b>4</b><br />

If I remove the / it works ok.

PHP Code:
$img_path "/images";
$handle opendir ($img_path
Any ideas how to open the images folder in the root.

Cheers

Wayne.
HullBorn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-01-2011, 09:39 AM Re: Problem opening directory using opendir
RonnieTheDodger's Avatar
Extreme Talker

Posts: 232
Location: Central USA
Trades: 0
Because it needs to be a file path, not a Url path.

Use something like this:

Code:
$img_path = $_SERVER['DOCUMENT_ROOT'] . '/images';
__________________
Ronnie T. Dodger

[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]
RonnieTheDodger is offline
Reply With Quote
View Public Profile Visit RonnieTheDodger's homepage!
 
Old 02-01-2011, 09:45 AM Re: Problem opening directory using opendir
Skilled Talker

Posts: 50
Trades: 0
Cheers Dodger,

That did the trick.
HullBorn is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Problem opening directory using opendir
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.67567 seconds with 12 queries