java - getPageContext().getRequest().getParameterMap() with multipart forms? -


Below I am using this test:

   & Lt; Cfoutput & gt; & Lt; Form method = "post" action = "# cgi.script_name #? First name = tony" & gt; & Lt; Input type = "text" size = "50" name = "page [content] [] [content]" & gt; & Lt; Input type = "text" size = "50" name = "page [content] [] [content]" & gt; & Lt; Input type = "hidden" name = "submit" value = "1" & gt; & Lt; Input type = "submit" & gt; & Lt; / Form & gt; & Lt; / Cfoutput & gt;  

We getPageContext () to retrieve a hash of form and URL scope during a post request. GetRequest () can get. Now this work is fine and dandy until you set the form's antioxidine function as "multipart / form-data":

   & Lt; Cfoutput & gt; & Lt; Form method = "post" action = "# cgi.script_name #" first name = tony "enctype =" multipart / form-data "& gt; & Lt; Input type = "text" size = "50" name = "page [content] [] [content]" & gt; & Lt; Input type = "text" size = "50" name = "page [content] [] [content]" & gt; & Lt; Input type = "hidden" name = "submit" value = "1" & gt; & Lt; Input type = "submit" & gt; & Lt; / Form & gt; & Lt; / Cfoutput & gt;  

What happens at this point is that any form field value received in Happ has been returned from getPageContext (). GetRequest (). GetParameterMap ().

Does anyone know how we can get this data or an alternative solution?

The whole reason we are using getPageContext (). GetRequest (). GetParameterMap () is the reason why comrade delivers an array as the value of the variable rather than the delimited list, such as using the form.

Update: This cumulative hotfix is ​​at 8.0.1 with 4.

Update: You can not use the list because the reason is "toayer" because it has two names of your name first name and both users What values ​​do CF (1 and 2) do, return a key in the form structure named first name with a comma-delimited list for two values ​​(1,2) Does. It's great, but says that the user enters the values ​​for that field which includes commas for the first field like 1,2,3,4 and for the second region 5,6, 7,8 The form structure for first name will have the value 1,2,3,4,5,6,7,8 this is not correct . Since now, getParameterMap () returns an array of values, I will have two elements such as: ["1,2,3,4", "5,6,7, 8 "] .

Update: See what HTTr.Cavendendata () is. It appears to be an empty binary

Update: Thank you Leigh it was using the getPartsArray () method on the Form Scope to detect and use it completely without getting GetPageContext. I did not even know that it is in existence!

Please keep the ideas coming!

(OK .. take two) it starts working with CF 9 is. I am currently unable to test with CF8. Can you give it a whirl?

  & lt; Cfif structkeyexists (form, "submit") & gt; & Lt ;! --- If this is a multipart request ...---> & Lt; Cfset variables.parts = form.getPartsArray () & gt; & Lt; Cfif structKeyExists (variable, "section") & gt; & Lt; Cfoutput & gt; & Lt; Cfloop array = "# variables.parts #" index = "P" & gt; & Lt; Cfif p.isParam () & gt; IsParam () = #p .isparam () # & lt; Br / & gt; GetName () = # p.getName () # & lt; Br / & gt; StringValue () = # p.getStringValue () # & lt; Hour / & gt; & Lt; / Cfif> & Lt; / Cfloop & gt; & Lt; / Cfoutput & gt; & Lt; / Cfif> & Lt; / Cfif>  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -