php file issue

Status
Not open for further replies.

swordsinfo

New Member
Hi guys quick q - Im looking to download files that are located outside the web root. During the upload process the users upload to a folder that was outside the root of the site (for security reasons). I now want to do the reverse for the admin users to download the files I have tried the following but to no avail


I think maybe I need to add something to the conf file or the htaccess maybe - according to host permissions are ok!


Is absolute apths an option also??


$file=$_SERVER["DOCUMENT_ROOT"]. "/../uploads/".$filename;
 

Forbairt

Teaching / Designing / Developing
Is this on shared hosting?

Are you allowed to upload things outside the web root and you're sure they are uploading ok? you've checked via FTP? :)
 

swordsinfo

New Member
Is this on shared hosting?

Are you allowed to upload things outside the web root and you're sure they are uploading ok? you've checked via FTP? :)


Hay,
Yes upload was not a prob and have full access to files. But cant get the php files to browse to that folder, maybe that sort of config is only for one way. I cant get script to find files!!

I wonder would absolute paths work or alias?? Or is there actually a simple fix?
Thanks again for input.

B
 

Forbairt

Teaching / Designing / Developing
Hay,
Yes upload was not a prob and have full access to files. But cant get the php files to browse to that folder, maybe that sort of config is only for one way. I cant get script to find files!!

I wonder would absolute paths work or alias?? Or is there actually a simple fix?
Thanks again for input.

B

Sounds like a permissions issue

I'd suggest throwing up a file such as ...

Code:
<?PHP
if ($handle = opendir('.')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            echo "$entry<br />";
        }
    }
    closedir($handle);
}

then changing the directory you're listing to if ($handle = opendir('./../')) {

and so on ... and then into your uploads folder ...
 

swordsinfo

New Member
Sounds like a permissions issue

I'd suggest throwing up a file such as ...

Code:
<?PHP
if ($handle = opendir('.')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            echo "$entry<br />";
        }
    }
    closedir($handle);
}

then changing the directory you're listing to if ($handle = opendir('./../')) {

and so on ... and then into your uploads folder ...

lovely hurling cheers for that bit of code - ill give that a whirl if it doesnt work do you have any recommendations - I was thinking alias? THere not that many files in the folder say 200 so I could move them to inside the web root but figure an alias to the folder would be easier. Site is with Letsh0$t so I presume I would have to ask them for this or can it be done thorugh cpanel?
 

swordsinfo

New Member
lovely hurling cheers for that bit of code - ill give that a whirl if it doesnt work do you have any recommendations - I was thinking alias? THere not that many files in the folder say 200 so I could move them to inside the web root but figure an alias to the folder would be easier. Site is with Letsh0$t so I presume I would have to ask them for this or can it be done thorugh cpanel?

Cheers for the code snippit the code worked perfectly to identify the problem - its listing other folders and sites in the public_html folder except my uploads folder - the perms on the uploads folder are set to 777 but it still wont list? any ideas?
 

swordsinfo

New Member
Cheers for the code snippit the code worked perfectly to identify the problem - its listing other folders and sites in the public_html folder except my uploads folder - the perms on the uploads folder are set to 777 but it still wont list? any ideas?

ignore the last it is seeing the folder but cannot open it

below is the process of the listing i added the following code

if ($entry == "uploads") {
$entrytemp = opendir($entry);

uploads

Warning: opendir(uploads) [function.opendir]: failed to open dir: No such file or directory in /home/eurotime/public_html/innovation.euretina.org/application/view/adminheader.php on line 39
.htaccess
index.php
..
..
..

so its lsiting the directory but cannot open it??
 
Status
Not open for further replies.
Top