Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 3 of 3
upload an image? 
 
bobh
Member
 
Total Posts:  32
Joined:  2007-08-31
 

Thx for the upload file it works great now for me on a xp box smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
zsamer
Jr. Member
 
Total Posts:  4
Joined:  2007-09-04
 

this is my solutions for windows:

$destinationFolder ereg_replace('^[A-Z]:'''$destinationFolder);

the full code is:

private function _createDestinationFolder($destinationFolder)
    
{
        
if( !$destinationFolder {
            
return;
        
}

        $destinationFolder 
ereg_replace('^[A-Z]:'''$destinationFolder);

        
//print $destinationFolder;
        
$path explode(DIRECTORY_SEPARATOR$destinationFolder);

        
$newPath null;
        
$oldPath null;
        foreach( 
$path as $key => $directory {
            $newPath
.= ( $newPath != DIRECTORY_SEPARATOR ) ? DIRECTORY_SEPARATOR $directory $directory;

            
//print $newPath.'<br>';
            
if( is_dir($newPath) ) {
                $oldPath 
$newPath;
                continue;
            
else {
                
if( is_writable($oldPath) ) {
                    mkdir
($newPath0777);
                
else {
                    
throw new Exception("Unable to create directory '{$newPath}'. Access forbidden.");
                
}
            }
            $oldPath 
$newPath;
        
}
        
return $this;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Hadifarnoud
Sr. Member
 
Total Posts:  210
Joined:  2007-10-07
Guildford, Surrey, UK
 

i have same problem,my server is linux. which code will solve this problem? can you attach working uploader.php file?

this is my modified uploader.php ( as you said )

private function _createDestinationFolder($destinationFolder)
    
{
        
if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder0777true))) {
  
throw new Exception("Unable to create directory '{$destinationFolder}'.");
}
return $this
        if( !
$destinationFolder {
            
return $this;
        
}
        
if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder0777true))) {
            
throw new Exception("Unable to create directory '{$destinationFolder}'.");
        
}
        
return $this;

        
$destinationFolder str_replace('/'DIRECTORY_SEPARATOR$destinationFolder);
        
$path explode(DIRECTORY_SEPARATOR$destinationFolder);
        
$newPath null;
        
$oldPath null;
        foreach( 
$path as $key => $directory {
            
if (trim($directory)==''{
                
continue;
            
}
            
if (strlen($directory)===&& $directory{1}===':'{
                $newPath 
$directory;
                continue;
            
}
            $newPath
.= ( $newPath != DIRECTORY_SEPARATOR ) ? DIRECTORY_SEPARATOR $directory $directory;
            if( 
is_dir($newPath) ) {
                $oldPath 
$newPath;
                continue;
            
else {
                
if( is_writable($oldPath) ) {
                    mkdir
($newPath0777);
                
else {
                    
throw new Exception("Unable to create directory '{$newPath}'. Access forbidden.");
                
}
            }
            $oldPath 
$newPath;
        
}
        
return $this;
    
}

moshe that attached uploader.php doesn’t work here :(
i have this error:

Unable to create directory '/var/www/vhosts/zigorat.com/subdomains/dev/httpdocs/media/catalog/product/'.
while media/catalog/product/ is 0777
 
Magento Community Magento Community
Magento Community
Magento Community
 
Hadifarnoud
Sr. Member
 
Total Posts:  210
Joined:  2007-10-07
Guildford, Surrey, UK
 

any solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
helpinghandhost
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-11-12
 

Hello,

Has anyone found a solution to this?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 3 of 3