Friday, September 30, 2011

Upload issue for Magento 1.6.0.0

I've seen lately the magento forum flooded with this issue.
When trying to upload an image for the product the section with the image name gets a red border and an error message appears.
When trying to upload something for the downloadable products...well..
same s**t different a**h**e (pardon my French).

Here is what I did to fix it:
The problem seems to be caused by the prototype v1.7.
It works great with prototype 1.6
Get the 1.6 version from here http://prototypejs.org/assets/2009/8/31/prototype.js
Create this file: js/prototype/prototype1.6.js and put the contents from the link above in it.
Now edit app/design/adminhtml/default/default/layout/main.xml and add this line
<action method="addJs"><script>prototype/prototype1.6.js</script></action>
right below
<action method="addJs"><script>prototype/prototype.js</script></action>

I don’t think it’s a problem if you edit this core file. I can assume that the guys at Magento will fix the issue with the uploader untill the next version (at least I hope it’s the same issue as reported here: http://www.magentocommerce.com/bug-tracking/issue?issue=12265 - and they claim it’s fixed)

I hope this helps someone
Cheers,
Marius.

30 comments:

  1. Thanks a lot for your post, it solved this issue for me, i'm using flash player 11 and changed the prototype from 1.7 to 1.6 removing the 1.7 from main.xml and it worked just fine.

    I really appreciate your post.

    ReplyDelete
  2. Thanks its workes Thanks alot

    ReplyDelete
  3. you rock man!! This solved the issue.

    ReplyDelete
  4. Threw up an error message. " function setActive() on a non-object in /mywebsite/app/code/core/Mage/Adminhtml/Controller/Action.php on line 96"

    ReplyDelete
  5. Hi Jason. I think you are missing the menu block.
    Try clearing the cache. This didn't happen for me before.

    ReplyDelete
  6. Please, is there a fix for this problem on Magento 1.6.2 ?
    Cause i have the same problem uploading a file on Downloadable Product, i tried this solution but it didn't fix the problem for me !!!

    ReplyDelete
  7. Make sure you have write permissions on the folders you are trying to upload the files to.

    ReplyDelete
  8. Really its very useful for topic.Keep writing some more interesting topics like a magento development.

    ReplyDelete
    Replies
    1. Hello Ava joseph.
      I usually write something on this (so called) blog when I encounter a problem and I have a quick fix for this. If you want me to write something please send me an 'interesting topic' that should be pretty general (not a specific problem that applies to a specific application) and if I have a quick solution I will write it here.

      Cheers,
      Marius.

      Delete
  9. For those of you that are still having this problem (especially with the Downloadable Products uploader), there appears to be a bug inside the Action Script (Flash) code that mangles any backslashes in the response. JSON requires double backslashes, but somewhere all double backslashes are getting collapsed into single backslashes. This causes problems on Windows based servers (or development machines.)

    To temporarily work around this I've added the following in Mage_Downloadable_Adminhtml_Downloadable_FileController::uploadAction() (app/code/core/Mage/Downloadable/controllers/Adminhtml/Downloadable/FileController.php @ ~line 58):

    $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']);
    $result['path'] = str_replace('\\', '/', $result['path']);

    This works by replacing any backslashes in the paths with forward slashes, which Windows will also recognize, but which won't get mangled by the buggy code. Obviously this is just a hack, but it will get you through until the core but is actually resolved.

    ReplyDelete
  10. I am trying magento 1.7.2.0 in images not upload. I am using host(godaddy).
    So please help me.

    Thanks & regards
    rajan

    ReplyDelete
    Replies
    1. Did you try the fix suggested in the post?
      If you did and it doesn't work, then you have an other problem. Check the permissions on the media folder and it's sub-folders.

      Delete
  11. i am trying to upload image in catalog using mozila firefox and in mozila i am getting SSL Error: Invalid or self-signed certificate Error and in Google chrome i am getting http Upload Error .Please help My Magento Version is 1.6.2.0 .Please anyone help me..

    ReplyDelete
  12. Works great on a 1.7.0.2
    Thanks !!

    ReplyDelete
    Replies
    1. not for me! same version but doesn't work

      Delete
  13. Rename the .htaccess file in /media folder.
    The issue will be solved!!!

    ReplyDelete
    Replies
    1. thks!!!!!you save my life!!!!!
      it works!!!!!!!

      Delete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. The comment above was deleted because it contained "self advertising". If you want a link to your website on this blog ask for it specifically and if it's worth it I will add it the "useful links" block.
      Don't advertise in comments.

      Delete
  15. Please help me! I got upload security error when trying to upload images. I tried to edit the xml file in adding this line, but the effect is that no shop backend is shown. I deleted this line, but i still have no backend.
    (Sorry for bad english)

    ReplyDelete
    Replies
    1. Clear the cache (contents of var/cache) folder. Also make sure you have write permissions on mediaa folder

      Delete
  16. Thanks for sharing this tutorial, everyone may also pay a visit to this website, there're many useful magento tutorials here
    Magento tutorial

    ReplyDelete
  17. Not wOrking . please helppppppppp..........

    ReplyDelete
  18. This didn't work for me in Magento 1.8.

    ReplyDelete
  19. I don't really understand what to do here. Where am I supposed to put this code? I find all the Magento gobbledygook incredibly difficult and clunky to understand, and I'm not a total idiot. I'm also not the website owner - so Magento was not my choice - but a subcontractor trying to upload a downloadable product for my client. You'd think that would be a simple thing. I'm also amazed that the problem described in this post is STILL an issue, THREE YEARS later!

    ReplyDelete
    Replies
    1. This issue does not reproduce (at least for me) for versions starting 1.7. Check maybe the source of the problem is different for you also.

      Delete