discolabs / cartjs

A Javascript library to power cart management for Shopify themes.
https://cartjs.org
MIT License
479 stars 85 forks source link

Upload file #87

Open bakura10 opened 8 years ago

bakura10 commented 8 years ago

Hi,

Did anyone had experience with uploading file properties using CartJS? When I set the properties into the addToCart method, it jsut sends the file name to the back-end instead of uploading it.

Thanks ^^.

gavinballard commented 8 years ago

As per https://cartjs.org/pages/guide#data-api-submitting-forms, there are browser limitations with uploading files via Ajax. These limitations are probably not as significant with modern browsers, so it may be possible to feature-detect and enable Ajax uploads conditionally based on browser support. Happy to look at PRs or to discuss further if there's an easy fix.

keyurshah commented 7 years ago

what do you think about using formdata for file uploads?

https://www.mkyong.com/jquery/jquery-ajax-submit-a-multipart-form/

thanks for this wonderful library!