2



I have this PHP code to access mapped drive Z:

$mapped = "\\\\192.168.0.xxx\\Shared";
system('net use Z: "$mapped" @Password /user:Username /persistent:no');

Then I check if the photo exists on the mapped drive:

$pic_path = "Z:/PHOTOS/SUB_FOLDER/Photo.jpg";
echo file_exists($pic_path);
//returns 1 (true)

The path is working fine. However, it returns a broken image. Why?

Please help. Thanks!

UPDATE:

I already tried these paths:

\\\\192.168.0.xxx\\e$\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>
\\\\192.168.0.xxx\\e:\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>
\\\\192.168.0.xxx\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>

All of them returns 1 value. But I still receive a broken image.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Jorz
  • 358
  • 5
  • 22
  • UNC paths are spotty in PHP at best, also, your PHP process is probably running without a user profile (ie. in IIS, unless you've explicitly loaded it, and even then it probably won't work) so mapping a drive like that simply won't work. You'll have more luck with the paths specified at the bottom, assuming there's no user account required. – Rudi Visser Sep 28 '16 at 09:35
  • Sounds ok to me. Tested by myself in my local network and it works. When you say "broken image", can you show us the code you use to get the image? How do you know it's broken, and what broken means to you? – Felippe Duarte Nov 17 '16 at 16:49

0 Answers0