voodish logo
tweet rss book of faces Linked In

Multiple Image uploads in Magento

As standard, Magento will not allow two uploads via the custom options panel of a product, simply returning an error in the cart. Here we explain a simple method of allowing this functionality, with just one line of code.

NEW: Magento Progress bar uploader and Lightbox Preview

Standard version

For the standard old version, simply navigate to:
Magento_Folder/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php

Around Line 145

if (!$upload->receive()) {

Change to:

if (!$upload->receive($file)) {

This quickly solved our dual image upload problem in Magento. However we have moved over to a Multiple Image uploader with progress bar, that works on Magento 1.3x and 1.4x. Read more about that here.

Download ammended File.php

Please make a backup of your current File.php both locally and server side.

magento_multiple_image_uploads.png

Related Articles

Comments RSS Feed

2 Trackbacks/Pingbacks

  1. Pingback: Two image uploads with custom options in Magento, Voodish Articles. | Magento News on December 1, 2009
  2. Pingback: Twitter Trackbacks for Image uploads with custom options in Magento, Voodish Articles. [voodish.co.uk] on Topsy.com on December 1, 2009

5 Comments

  1. webbywoo December 1, 2009

    Neat, thanks for this; thought I was going to have to pay a developer to build this in! :)

  2. Go to Top of the page

  3. Stuart August 14, 2010

    How do you view and download the uploaded image once it has been attached to an order?

    Kind Regards
    Stuart

  4. Go to Top of the page

  5. admin August 14, 2010

    Hi Stuart,
    You should be able to view the image in the usual Magento fashion.

    The image is uploaded to:
    sales/download/downloadCustomOption/id/id#/key…

    Once a sale is made you can find a link to the image in:
    Admin -> Sales -> Order -> Choose order -> Items Ordered Panel, link to image will be there.

    The buyer will also receive an email with their unique link to the image.

    Note: It isn’t kept in a flat file directory for security purposes.
    Hope this helps :)

  6. Go to Top of the page

  7. Garrett September 1, 2010

    I’m searching for the file but there are no subfolders in /Type. I’m running 1.3.1. Any chance this is somewhere else?

    Thanks!

  8. Go to Top of the page

  9. admin September 1, 2010

    @Garrett: It’s the File.php (file) within the Type (folder) that you need to edit, there are no sub-folders within the Type folder on a default 1.3/1.4 installation.

    The File.php (file) is in the same location on 1.3* and 1.4*.

    Firstly, check and double check you are looking at the correct folder:

    Magento_Folder/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php

    If that wasn’t the reason, chances are the file has been removed at some point. Try downloading a new 1.3* file or use one of the following files:

    or use the Edited for multiple image uploads Magento, see main article.

  10. Go to Top of the page

Leave a comment