diff --git a/core/Http.php b/core/Http.php
index 0d5df681c664b19b44bf325b067e3d02f8935282..f435a0015bf89b95ffe0a87e09f174162ec847da 100644
--- a/core/Http.php
+++ b/core/Http.php
@@ -62,7 +62,7 @@ class Piwik_Http
 		if($destinationPath)
 		{
 			// Ensure destination directory exists 
-			Piwik_Common::mkdir(basedir($destinationPath));
+			Piwik_Common::mkdir(dirname($destinationPath));
 			if (($file = @fopen($destinationPath, 'wb')) === false || !is_resource($file))
 			{
 				throw new Exception('Error while creating the file: ' . $destinationPath);