Commerce upload image with order

General information for the website: Printing E-commerce website built in Commerce

Description of requirements/features: For every product on the website it is required that an image(in some cases 2) is uploaded with the order, at the minute adding a field to the line item is not sufficient for these reasons.

- Clicking add to cart on a product does not check if an image has been uploaded, it only checks if one has been selected from the users computer, and even if one has been selected it does not upload the image, the product then gets added to cart without an image attached with the order.

- Images are not deleted if the order is not processed and paid for.

- Images could be continuously uploaded to the server and our bandwidth reached by anyone naughty enough to do so.

- The images should be sent to our orders@ email address with their respective order details.

I don't see there being a module out there that could achieve this, I am open to the possibility that there might be and also any advice as to where to begin developing my own custom module.


Posted: Sep 16, 2014


joshmiller Josh Miller on September 16, 2014


I need a bit more information on why attaching images to line items isn't working for you. Another possibility is to add fields to your Order and expose them on the checkout process.

Note that others have succeeded in this particular industry using line item fields:



Joeuk on September 17, 2014

Hi Josh,

Like I said above there is nothing to stop someone uploading files over and over is there?, also the image widget expands to multiple upload fields when I change the attributes on the product display. https://www.drupal.org/node/2269295

I just need the user to beable to upload a file with their order and that to be stored and the link sent with other info to an email address.

I noticed that on the website you have shown me that when clicking on add to cart the file is uploaded, this does not happen when I add an upload file field to line item on my site, it does not upload it just adds to product to the cart.

There is the issue of that if someone orders multiple products they need to upload maybe 1 or 2 files for each product, hence doing this on the order page would mean having to check what is being ordered, then allow an image field for each product.

At the minute when I click upload on the add to cart form, the image just gets uploaded to the server and sits there, how would I attach it to an order?

The ideal scenario would be something like what webform does, where it lists all orders with any images/files uploaded, you can then delete each order and that will delete the image/file also.

Is this not possible?

Thankyou for your reply.