File upload in Magento

Featured Image

Whan of the most enticipated and needed things in Magento is File upload Custom Option. As discussed last year at Magento Forum, it is not completed nor tested.

Now, Magento already have frontend and admin part of file upload option implemented in themes. Since backend part is still missing, understand that this still doesn’t work, however, if you’re interested how it looks, read on ..

Frontend html is found in:
app/design/frontend/default/default/template/catalog/product/view/options/type/file.phtml

Frontend javascript code in:
app/design/frontend/default/default/template/catalog/product/view/options.phtml
(optionFileUpload js object = asynchronous iframe upload)

You can enable file upload custom option if you add:

<file translate="label" module="adminhtml">
	<label>File</label>
	<render>adminhtml/catalog_product_edit_tab_options_type_file</render>
	<types>
		<file translate="label" module="adminhtml">
			<label>File Upload</label>
		</file>
	</types>
</file>

inside node:
config->global->catalog->product->options->custom->groups

in:
app/code/core/Mage/Catalog/etc/config.xml

Now you have new File Upload option that you can add to product!

We are coding module of similar functionality for one of our clients as we speak, but we have our fingers crossed to see this option in next Magento version!

37
Top

Care to rate this post?

Author

Ivan Weiler

Technical Educator and Consultant

Ivan is a Technical Educator and Consultant. He gained lots of experience managing some of the most complex Magento projects we had at Inchoo.

Other posts from this author

Discussion 37 Comments

Add Comment
  1. kiat

    I’d like to have an option for customers to upload their pictures of wearing or using the products and placed these along the product images for all to view. Can it be a possibility with this file upload method?

  2. This upload method will be primarily used to submit some file along purchasing a product. For your case i suggest independent upload form somewhere on site, couse those people already purchased product.

  3. neo750

    hello folks,
    Where can i get this option, i really need this fonction to mu futur website.

    yours sincerely,

    neo

  4. neo750

    I modifiy the xml file as you mentionned but I can’t see any attributes “file upload”.
    I might have done things wrong ?

  5. I can tell you that this functionality will be available with magento v1.3 – also, you will see if you enable the fileupload at the moment that it is going to cause you problems without further modifications.

    Cheers
    Adam
    OnTap Creative
    Tweakmag

  6. Hi Adam,
    That sounds lovely. :)

  7. hello guys, i modified xml file but i can’t see this option file upload pls help!

  8. Magento is so powerful,and i have to give up joomla+virtuemart based website and build my online store with magento.

    does magento has CSV bulk upload function?

  9. I have the same problem like Dilizo. I’ve modified xml file but i can’t see this option file upload. Can someoane help, please…

  10. File upload Custom Option is built in in new Magento 1.3.0. Just released!
    I just tested it, works great ;)

  11. David

    It works for single file upload option, but not for multiple (if you want to have more than one file upload option).Will upload only first file.

  12. Hi David

    Did you also try to make two custom options for upload. If we do this in magento one is working and the other one is not working.

    see also http://www.magentocommerce.com/boards/viewthread/39230/

  13. hi
    i m in very trouble in magento.
    i have upgreaded magento in to 1.3.2.4 version
    and after upgraded it is not shown upload image button and browse file button so please help how can i upload product image
    i have also new version of flash player rather than it is not appear .

    please reply me quick it is very urgent

  14. fred

    Simple question – where is the button to upload images to put on individual pages like the home page?

  15. ron k

    where does the file go once uploaded? how does the admin see the file?

  16. If you would like a of the shelf module to solve this problem Magento Mechanics have solved the issue with a easy to install module that prodives extra functionality.

    it can be found at: http://magentomechanics.com/product-file-uploader-v2.html

  17. Gary

    @Magento Mechanic, your extension does not do what this page is talking about. Unless I’m wrong, your extension allows files to be uploaded and linked to PRODUCTS. This page is talking about files uploaded and linked to ORDERS. Your extension looks great, but it’s not even close to the same thing. If you coded an extension that lets me upload a file in the backend to link it to an order, I’ll buy it.

    @ron k, the file is linked to the order and there is a link to download it in the backend when you view the order.

  18. Does anyone know where we could find a file upload progress bar, my files are taking ages to upload ??

  19. Andy

    Hi,
    Thanks for posting this. Does anyone know where does the uploaded files are sent to. In admin under sales>orders it shows he file but cant view it or save it.
    Any help would be appreciated.
    Thanks

  20. kiat asked first “I’d like to have an option for customers to upload their pictures of wearing or using the products and placed these along the product images for all to view. Can it be a possibility with this file upload method?”

    Did anybody find a solution meanwhile ???

  21. bsr

    I want to set a file upload option in the customer’s My Account dashboard. I want customer to uplaod an image from his login dashboard and that uploaded image can be seen in the admin panel and frontend both.
    If someone knows how to do that or have an idea please help me.
    Thanks in advance.

  22. Jai

    Hi,

    I want to add image upload functionality on review form. Can you please help me.

    Thanks,
    JAI

  23. Jai

    Hi, I wanna add image uploaded functionality on review Form and want to display with each review. Can anyone pls help me on this?

    Thanks in advance.

  24. Hi

    i have created form with my custom extension for image uploading it upload image perfectly with magento uploader

    new Varien_File_Uploader('logo')

    but when i edit the form without upload any image it throws error:

    Warning: preg_match() expects parameter 2 to be string, array given in /lib/Varien/Data/Form/Element/Image.php on line 61

    please help if you have any solution for this.

  25. Can you post the code from image.php ?
    The error ist thrown on line 61, maybe a parameter is missing?

  26. For those insterested, we have just release a front-end file upload progress bar for Magento 1.4.xx. You can find more information here: http://www.squarefootmagento.com/news/file-upload-progress-bar-magento

    Demo here: http://squarefootmagento.com/demo/magento-file-upload-progress-bar.html

    Cheers.

    SFM

  27. Your front end looks interesting but i miss some really important functions.

    Can everybody upload and delete files?
    Or is the upload only possible if the user is logged in?
    Is the uploaded file assigned to the user and the selected product?
    Can i add a description and a title to the uploaded file?
    Do you support a function to read out the uploaded files (a hrefs) on a another position on the product page (like PHP getProduct().getUploadedFiles()) ?

    Cheers
    David

  28. Hi,

    Its a bit of an off topic, but would you know of a way to add file attachment to the customer registration ? I’ve managed to add custom fields but I´m struggling a bit with file attachment

    Regards,
    James

  29. Wonderful solution. Thanks! Loved your blog by the way ;)

  30. Hi,

    If you are looking to upload files and attach them to a product for display to a user then we have created a plugin that will easily solve this.

    With our plugin you can browse to the file in the backend and attach it to one or more plugins easily. You can upload any file in to Magento (mp3, doc, pdf, wav, xsl, ppt, mov, avi, flx or anything else you can think of).

    You can find the plugin here:
    http://www.magemechanics.com/product-file-uploader-v2.html

  31. It worked, tnx. Bless.

  32. Dyna May

    Hi,

    I want to have a feature where first a customer place an order and then as per selected option, they can upload number of images from their account for that order.

    For example,
    1) Customer purchase process of 10 images at $100
    2) They pay $100 to us
    3) Now in back end, since they have purchased 10 images for this order, they can upload up to 10 images which we as admin can see and work on that.

    Is it possible with magento and if so how?

    Thanks in advance,
    Dyna May

  33. Sanjoy De

    How to upload picture using magento from frontend?
    Please suggestion me.

  34. DB

    Nice! didn’t knew it existed and was almost going to spend money on custom module.

  35. Sony

    Does anyone know where the files goes once customer uploads. Unable to find anywhere… Not even in my backend media folder files.

  36. hai am trying this if i am upload image am getting Please specify the product’s required option(s). this error help me to fix this issue

  37. Hai I am using magento 1.8.1.0. was it support for my version because if i am upload an image from front end
    “Please specify the product’s required option(s)” error occurs guide me to solve this its urgent

Add Your Comment

Please wrap all source codes with [code][/code] tags.
Top