Whittie
Member
Registered: 11th Aug 06
Location: North Wales Drives: BMW, Corsa & Fiat
User status: Offline
|
My last magento post this week, promise
Basically, customers are abled to upload up to 1000 images, maybe more, I need a way of doing this and relating it to the correct customer.
It's pretty much a dead cert that it has to be standalone as Magento would shit itself, it barely allows 1 jpg and that's under 2mb limit... Oscommerce is out of the question (Gaz), as i've just spent a long time working on the theme, addons and template, it's all ready to go.
On the order page once the customer has paid, they'll have options, upload as a zip / rar folder or i'd like them to be linked to an image uploader that only relates to them somehow.
The html 5 one is rather epic: http://html5demos.com/dnd-upload can see it previews and uploads to the server no problem. How would I make it so it's only obvious to each customer though, someone could do an epic upload of 800 photos and someone else uploads 60 inbetween them all.
Only ways I can think around it are getting the customer to rename their photo's to the order number, but this will make me look silly, write some kind of script to link with the last X amount of order numbers in Magento and get them to tick that it is their corrosponding order and it'll rename images automatically?
Other way I thought would be to confirm the order and they'll get an email back and i'll send them their own login to project send, which can be re-branded...? ( http://code.google.com/p/clients-oriented-ftp/ )
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
Grab the filename(s) prior to uploading, bit of AJAX, dump to DB table and link to the customer.
I'd also check out Uploadify and the HTML5 version of that; shed load of functionality and, iirc, it supports chunking.
|
Whittie
Member
Registered: 11th Aug 06
Location: North Wales Drives: BMW, Corsa & Fiat
User status: Offline
|
quote: Originally posted by Dom
Grab the filename(s) prior to uploading, bit of AJAX, dump to DB table and link to the customer.
I'd also check out Uploadify and the HTML5 version of that; shed load of functionality and, iirc, it supports chunking.
Just googled Uploadify and all the links i'd been on. I remember coming to the conclusion that i'd fuck it up on the DB side and spend too long get it working. Is it fairly simple to do?
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
If you were to use Uploadify then there is a 'onUploadSuccess' event which triggers on each successful upload. So you can either fire off an AJAX request (to server-side page) with the filename (use 'file.name' property) and customer ID on each trigger or stick the filenames into a delimited string or use an array and then fire off a single AJAX request with that string/array + customer ID when the 'onQueueComplete' event triggers (which is once the entire queue is processed).
The server-side/php is simply taking the filename(s) and inserting rows into a table along with the customers ID.
You then end up with a directory full of files and a table linking the customer id to individual filenames. You then do what you want with the data eg - could get it compress customers order files then send you an email with them etc etc
Edit - Another solution is to create a new directory for each session/order with customer details and bung the files into that ie: -
/uploaded_files/session_23487_customer_2/ (files)
/uploaded_files/session_27812_customer_2/ (files)
/uploaded_files/session_15673_customer_876/ (files)
I'm sure you get the idea.
[Edited on 24-10-2012 by Dom]
|
noshua
Member
Registered: 19th Nov 08
User status: Offline
|
quote: Originally posted by Dom
Grab the filename(s) prior to uploading, bit of AJAX, dump to DB table and link to the customer.
Seems the easiest option - generate a random identifier with something like the timestamp to prefix all the images or a folder to prevent image overwrites and what not.
|