Hi

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.

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.

Hi

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:
http://domain.com/folder/file.doc
-or via ip-
http://184.294.495.304/folder/file.doc
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

vssp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.