Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
When I click on a link generated by a directory listing from inside a php page (to try and download), the server responds with '404 - Not Found'. Links will download just fine when they point to files within the webserver directory area (www), but not anywhere further up in my server.
I am fairly certain it has something to do with apache and directory permissions.
I have php and apache (lighty - lighttpd) webserver running just fine on my DNS 323 (funplug).
Should I include something like the following? $ignore = array( 'cgi-bin', '.', '..' );
Other suggestions?
Here's my code:
[php]
<?php
$count = 0;
if ($handle = opendir('/mnt/HD_a2/tempDwnloads')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {$count++;
print("<a href=\"".$file."\">".$file."</a><br />\n");
}
}
echo '<br /><br /><a href="..">Return</a>';
closedir($handle);
}
?>
[/php]
Offline
If www is your root dir as defined by lighttpd (or whatever you're using), then you can't reference anything above it (since the server thinks www is the highest level already). What I do is just create a hard-link to the file I need (ln -snf /mnt/HD_a2/Media/Pictures/pictureIwant.jpg /mnt/HD_a2/www/Pictures/pictureIwant.jpg) so accessing the hard-linked achieves the same thing since they are both pointing at the same blocks of data on the disk.
Not sure how often you update/change your library, but a batch hard-link script would do a one-time job..
Last edited by bound4h (2010-12-23 18:42:53)
Offline
Hi, thanks for your quick reply.
Can a hard link point to an entire directory and list what's inside?? The thing with a sym-link is that it opens up my contents to anyone, whereas I can put a login feature with password in php. Alternatively, I have a secure ftp-port setup on my dns-323 with password, but iPhones/iPod-touch or iPad won't browse to ftp sites.! Accessing my dns323-content with my iPhone is the whole purpose (i know there are apps that do this now - i want to do it myself).
I have other working php scripts that point to a level above www, only I'm not that good w/PHP to know which code-snippet does the trick.
Tnx.
Last edited by esebag (2010-12-23 22:02:27)
Offline
Ok, I solved my problem:
I created a symlink towards the area where I need to access my files, and the php file outputs a list of the directory contents. The symlink seems to bypass the link download problem for files outside the www server area. Also have a php password to protect access.
Thanks for any other suggestions you/others may have like how to access smb drive through my iPhone would be welcome.
Last edited by esebag (2010-12-24 01:51:10)
Offline