Yii Get Data From Local Drive

i wonder, can yii get data from local drive?

for example, my yii is in C drive


and i want get image from drive E in


i’ve been tried this solution

<?php $path = 'file:///E:/images/myimage.jpg'?>

		<img src="<?php echo $path ?>" width="100" height="100"/>

but there’s error

Not allowed to load local resource:file:///E:/images/myimage.jpg

Try this path:


Of course it may only work in Firefox. More

You could create a virtual host to your images folder.

@msoa: your answer just like what i already do

@outrage: virtual host?could you explain to me?

outrage order is that you have to place your files in a location to be seen with the web server. meaning the web server have authorization to access the files location.

Creating virtual hosts on Apache 2.2

Also there are very tutorials on the Internet.

@msoa: i’ve tried it but i can’t connect to my localhost.

Did you restart Apache after the changes(can do this forom Service Manager)? Also i think you have to restart Windows Network Service. I’m not very familiar with Windows, for simplicity restart your system and try again.

Don’t for get You should get a response from the Loop-Back address, like this:

PS C:\Users\TMP> ping -n 3

Pinging with 32 bytes of data:

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

Ping statistics for

    Packets: Sent = 3, Received = 3, Lost = 0 (0%

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms