Jump to content

[SOLVED] Important Question


Solar

Recommended Posts

Hello Once again, my favourite site to ask PHP Questions. I've looked all over but it's hard to google a specific question.

 

Is there a script that will allow me to view a folder in my computer if my website/apache is running off my own computer? Like lets say if I made a "page" for people to upload there files, is there a way to display all the files for them? Or like if I wanted to display pictures on my website but keep the pictures in the "My Picture" folder of my computer?

 

Like this browser for example; http://beta.armagetronad.net/resource-browser/resource/

 

Thanks!

Link to comment
Share on other sites

I'd use readdir().

Here's an example of a directory reader for a template chooser. This assembles an array that will be passed off to a builder class that assembles a dropdown menu with the array items produced by this code.

 

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) 
{
  		if ($dh = opendir($dir)) 
	{
      			while (($file = readdir($dh)) !== false) 
		{
			if (($file != ".") && ($file != "..") && ($file != "Download"))
			{
            				$template_options[$i] = $file;
				$i++;
			}
		}
       			closedir($dh);
   		}
}

Link to comment
Share on other sites

You mean you want to have your website pull the pictures directly from your computer and not the server?  Well technically you would need to store your pictures on your server.

 

So for it being a local server - you would need to have a directory within the folder/directory structure of the web server running on your computer.  Your locally ran web server would have no 'rights' to browse outside of the 'server realm'.  That would be a huge security risk.

 

There are ways that you can browse your computer locally and upload the file to your server folder, but this is not what you are looking for.

 

Link to comment
Share on other sites

You mean you want to have your website pull the pictures directly from your computer and not the server?  Well technically you would need to store your pictures on your server.

 

So for it being a local server - you would need to have a directory within the folder/directory structure of the web server running on your computer.  Your locally ran web server would have no 'rights' to browse outside of the 'server realm'.  That would be a huge security risk.

 

There are ways that you can browse your computer locally and upload the file to your server folder, but this is not what you are looking for.

 

Okay, lets not worry about the out side the server question.

 

I've made a script that will allow users to upload there files to my website, but only with my permission. With the site I gave you, I want to be able to see all the peoples names, and their folders. I've allready made their folders.. so the my site would have.. sitelink/files/theusername/

 

So instead of me having to update the page with the new user all the time, is there a browser script that will allow me to see everyones folder at once?

Link to comment
Share on other sites

Depending on your ISP, and network settings it is possible to have your local computer act as a web server, I have my own personal web server online that I use to test scripts and demo scripts that I'm developing for clients. Me personally I use No-IP as a DNS server cause their sub-domains are free.

 

All I can understand from your question is that you possibly have apache/windows running off your local computer and are wondering if there is some script you can use to display contents of a folder on your local computer this is entirely possible. I have all the music shared on my local test server. I can demonstrate: http://darkangel.sytes.net/music/

this is so I can listen to my music where ever I am.

Link to comment
Share on other sites

Depending on your ISP, and network settings it is possible to have your local computer act as a web server, I have my own personal web server online that I use to test scripts and demo scripts that I'm developing for clients. Me personally I use No-IP as a DNS server cause their sub-domains are free.

 

All I can understand from your question is that you possibly have apache/windows running off your local computer and are wondering if there is some script you can use to display contents of a folder on your local computer this is entirely possible. I have all the music shared on my local test server. I can demonstrate: http://darkangel.sytes.net/music/

this is so I can listen to my music where ever I am.

 

This is what I was looking for, Maybe I can fiddle around and get exactly what I need. Zina. Thanks a lot!

Link to comment
Share on other sites

You can access any files on any pc, if it on your own network,

 

As long as you got php running on one computer..

 

I got my localhost computer http, setup with 10 different server's and i can access all of them via the web server.

 

all i do is create a php script, To access the folders i want to see.

 

it very straight froward.

 

To be honest i even got into ftp and curl and soup, And can even access computer files outside my personal web server.

 

if you got a dynamic ip, Meaning a ip that changes often, Then your need to use

a dns service to point back you your ip. This cretes a static ip using the dns service,

each time your ip changes, You can use a client software to update you dynamic ip

to the dns service provider.

 

 

 

 

Link to comment
Share on other sites

 

This is what I was looking for, Maybe I can fiddle around and get exactly what I need. Zina. Thanks a lot!

Zina, is just for music files, but there is something else I could recommend PHPFileNavigator, which is something I need to implement into my site, is a decent file manager for PHP its not the best but it works well enough for me. And its free GPU license so. And like redarrow said you can do stuff like that if you own the network, but some non-business ISP's do block the port 80.
Link to comment
Share on other sites

If it blocked use port 8080 lol. shhhhhhhhhhhh

lol I thought I had to do that because for some reason I couldn't access my site through the IP settings but come to find out that I cant do the port forwarding through my local network so I have to use my local IP. and lucky for me my port 80 is untouched yet my ISP is against people hosting their private web servers.
Link to comment
Share on other sites

 

Sorry solar for butting in........

 

 

my ip hates you hosting web site on there ip as well, But guess what one day they

said ok you use a web server i won lol ye haaaaaaa i thort, But guess what they did and it upset me,

buggers blocked the out going mail port 25 lol.

 

still got no luck getting around it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.