I am trying to open the explorer window using php code .But i got the security issue .Please help me how to solve the issue.

<a href="file:///opt" target="_blank">adas</a>

I got this error message Please help me how to fix the issue

Security Error: Content at http://localhost/test.php may not load or link to file:///opt.

8 Years
Discussion Span
Last Post by vssp

It is because you are using the "file" protocole. When managing documents with php, use a relative path which does not breach apachies web root settings. So if your script is in the directory "C:/xampp/htdocs/example/test/index.php" and you want to unlink/delete a file in the web root directory then you would use the string "../../file.php" but with xampp for example, you can't delete anything above the htdocs folder as that is the web root. So try and use relative paths that do not breach the web root.



Thanks for your reply.

I need just open the given path using php . No need for edit or delete the file.

Please advise.


I have just done a few tests and it looks like you need to use the http protocole and not the file protocole under the windows operating system due to some windows security feature. I tried both php and javascript to access a file under the file protocole and the error as you mentioned occured. So try locating the file from an address like:
-or via ip-
If you choose to use the ip method you will need apachie installed and the web directory setup. Also you will only be able to access through the http protocole what is theoretically online although the files can be hidden from other users via htaccess. Other than that, I would suggest using a more dedicated client side language such as Java to do the job.


Thanks For your clarification .

Thanks you so much

bye now


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.