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 2 of 3
upload an image? 
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Hm.. you are not using Windows on your server right?

Ok, let’s try this:
in lib/Varien/File/Uploader.php:

private function _createDestinationFolder($destinationFolder)
{
///... on approximately line 330
  
foreach( $path as $key => $directory {
/// add this:
    
if (trim($directory)==''{
      
continue;
    
}
/// before:
  
if (strlen($directory)===&& $directory{1}===':'{
///...
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

Right my server is a linux running apache 2.2.  I will try your change and report back…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

ahhh different error message this time:

Unable to create directory ‘/var’. Access forbidden.

The var directory is 777 and all files underneath.

The var dir has the right ownerships but these two folders have apache as the owner:
drwxrwxrwx 4 apache apache 4096 Sep 16 11:10 cache
drwxrwxrwx 2 apache apache 90112 Sep 20 13:15 session

If my other folders are designus.psacln shouldn’t those two be the same?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Weird, could you paste here the output from:

private function _createDestinationFolder($destinationFolder)
{
/// insert this temporarily for output:
  
echo 'DESTINATION: ' $destinationFolder; die;
///...
}

Try to upload, paste here the output and remove the line.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

I changed the ownerships of all the files below the var folder to designus.psacln and pasted your code and output is:

DESTINATION: /var/www/vhosts/designhosting.us/httpdocs/magento/media/catalog/category/

I think I should maybe start over but the way I had to install it at first was to change the line in the index.php to 5.1.0 and to comment out the mcrypt line in the install.xml file because I couldn’t use the wiki post for php5.1.6 since there was not a cgi-bin folder.  I did try creating one in the magento folder but still couldn’t install.

Thanks for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jorg
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-09-12
Regensburg | Bavaria
 

I’m not sure ... but are you talking about the same problem I’m facing?
See this thread ..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

That’s what another person on this thread posted but that error message is not showing up for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Melinda: ok, in same place you pasted echo “DESTINATION: “… paste this:

if (!(@is_dir($destinationFolder) || @mkdir($destinationFolder0777true))) {
  
throw new Exception("Unable to create directory '{$destinationFolder}'.");
}
return $this;
let me know if this works
 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

YES THAT WORKS!

http://www.designhosting.us/magento/catalog/category/view/s/pants/id/24/

pretty funny pair of pants! LOL

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Great smile

Thank you for working with us on this

 
Magento Community Magento Community
Magento Community
Magento Community
 
Melinda
Member
 
Total Posts:  49
Joined:  2007-08-31
 

The previous post was for uploading an image to a category which works.

On a product image I can upload a small and thumbnail image like I did for the product under the “pants” section but when I try to upload a main image I get these errors but the image does upload:

NoticeUndefined index:  filename in /var/www/vhosts/designhosting.us/httpdocs/magento/lib/Varien/File/Uploader.php on line 367
[0] in Varien_File_Uploader
->_renameDestinationFile("/var/www/vhosts/designhosting.") in /var/www/vhosts/designhosting.us/httpdocs/magento/lib/Varien/File/Uploader.php on line 173
[1] in Varien_File_Uploader
->save("/var/www/vhosts/designhosting.") in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Backend/Image.php on line 51
[2] in Mage_Catalog_Model_Entity_Product_Attribute_Backend_Image
->afterSave(Mage_Catalog_Model_Product)
[3] in call_user_func_array(Array[2]Array[1]in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 578
[4] in Mage_Eav_Model_Entity_Abstract
->walkAttributes("backend/afterSave"Array[1]in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1141
[5] in Mage_Eav_Model_Entity_Abstract
->_afterSave(Mage_Catalog_Model_Productin /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Catalog/Model/Entity/Product.php on line 52
[6] in Mage_Catalog_Model_Entity_Product
->_afterSave(Mage_Catalog_Model_Productin /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 808
[7] in Mage_Eav_Model_Entity_Abstract
->save(Mage_Catalog_Model_Productin /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Catalog/Model/Product.php on line 121
[8] in Mage_Catalog_Model_Product
->save() in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 276
[9] in Mage_Adminhtml_Catalog_ProductController
->saveAction() in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php on line 232
[10] in Mage_Core_Controller_Varien_Action
->dispatch("save"in /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php on line 138
[11] in Mage_Core_Controller_Varien_Router_Standard
->match(Zend_Controller_Request_Httpin /var/www/vhosts/designhosting.us/httpdocs/magento/app/code/core/Mage/Core/Controller/Varien/Front.php on line 139
[12] in Mage_Core_Controller_Varien_Front
->dispatch() in /var/www/vhosts/designhosting.us/httpdocs/magento/app/Mage.php on line 356
[13] in Mage
::run("base"in /var/www/vhosts/designhosting.us/httpdocs/magento/index.php on line 27
 
Magento Community Magento Community
Magento Community
Magento Community
 
Dan Orsborne
Member
 
Total Posts:  72
Joined:  2007-09-20
 

Thanks Moshe.

 
Magento Community Magento Community
Magento Community
Magento Community
 
prosurf
Jr. Member
 
Total Posts:  11
Joined:  2007-09-06
 

Melinda, could you post for download or mail me the working Upload.php please?

Thanks

Mark

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@prosurf: see here: http://www.magentocommerce.com/boards/viewthread/424/#t3050

 
Magento Community Magento Community
Magento Community
Magento Community
 
prosurf
Jr. Member
 
Total Posts:  11
Joined:  2007-09-06
 

Thanks, I’ve tried that one but get the same problems as melinda describes. When I try the code changes in the posts following all I get are blank pages after the upload. I was hoping for a copy of Upload.php that works on melinda’s centos box as I have the same problem on a fedora core 6 dedicated server with matrix as the domain admin system.

Thanks again

Mark

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