Forms API + Multistep + File uploads problem

mscdex - May 8, 2007 - 20:47

I'm having a problem with FAPI in 5.1. I have a multistep form (6 steps) with redirect set to false (if that matters) and enctype set to multipart/form-data. On the third step I have several file upload fields. I notice that when I finally redirect on (only have #redirect = true for the final step) after my final step, my php code is not able to see the files that were selected for upload in the third step. Do I have to deal with the files in the following step (step 4) in order for me to have the files uploaded, or is there a way to persist the filenames to be uploaded so they will upload after the final step?

I've been having problems

Island Usurper - May 8, 2007 - 20:53

I've been having problems with making fields persistent when they're more complex than a string, too. I was lucky in that I didn't need the complicated fields (a set of checkboxes) until the last step, so I'm able to process the form then. I just couldn't use the back buttons I made and come back to that step with the checkboxes already filled out the way I had them.

I guess this is really just a "Me, too" post.

-----
Übercart -- One cart to rule them all.

Well, all of my other fields

mscdex - May 8, 2007 - 21:11

Well, all of my other fields persist just fine. However, the fields of '#type' => 'file' do not persist at all.

How do you do it?

Island Usurper - May 11, 2007 - 14:06

For most of the fields, I had to resort to putting hidden fields with the form data in them for subsequent steps. I haven't found a similar method for a set of checkboxes because it returns an array of values. I tried serializing that array, but maybe I should have used html_entities() too.

-----
Übercart -- One cart to rule them all.

 
 

Drupal is a registered trademark of Dries Buytaert.