Closed (fixed)
Project:
Ubercart
Version:
6.x-2.4
Component:
Cart/checkout
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2011 at 10:53 UTC
Updated:
2 Oct 2011 at 20:56 UTC
Hi everyone,
Currently I am working on a module to allow customers upload files for products with Enable Upload setting on Node form.
Right now working on Checkout Panel to get files, successfully rendered the fields for products.
But on 'process' $op for hook_checkout_pane's callback function, the PHP $_FILES array is receiving only single file from ending field out of the file fields rendered.
Tried all the ways dpm(arg2), dpm($_FILES), print_r($_FILES), all are giving the same output.
Please check the attached views of before and after submit state.
Thanks & Regards,
Tajinder Singh
| Comment | File | Size | Author |
|---|---|---|---|
| Checkout_after_submit.png | 11.53 KB | tajindersingh | |
| Checkout_before_submit.png | 8.02 KB | tajindersingh |
Comments
Comment #1
tajindersingh commentedSorry, Changed misspelled title 'Checkout Panel' to 'Checkout Panes'
Comment #2
longwaveStrange that one file gets through, instead of both or none. What is the name of your file upload field in the HTML? Looks like it's "panes" - are you using the same name for both fields?
Comment #3
longwave#83698: $source parameter in file_save_upload() not work as expected when field is in a fieldset with #tree set to TRUE seems relevant.
"You will run into problems if you try to use more than one file field inside a fieldset. In that case the last file field is returned."
Comment #4
tajindersingh commentedHi longwave,
Thanks for the quick hints.
The forms api suggests that file field doesn't support #name property, but it does in this case.
I just set the #name different for both the fields and now it is working fine.
Thanks again,
Tajinder Singh
Comment #5
tajindersingh commentedmarking solved
Comment #7
juankvillegas commentedThank you TajinderSingh for your suggestion. I used it an it worked.
But in my custom pane, when $op == 'process' I added this little code:
This is because file_save_upload will search the file information only in a specific location under $_FILES array.