print image as a background-image
You are retrieving the absolute url of the file correctly, but your quotes in style attribute are a little mixed up.

Try this:

&lt;?php 
print '&lt;div style="background-image:url(' . $url . ');"&gt;&lt;/div&gt;';
?&gt;