macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: Uploading a file and inserting values in db from the same form

Subject: Re: Uploading a file and inserting values in db from the same form
From: GArlington
Date: Tue, 02 Oct 2007 03:15:56 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion

On 2 Oct, 05:37, "bossep" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> Hello all,
>
>  I,m not sure this is a CF 8 issue or not but:
>
>  I have form with a few ?normal fields? then a few input type file fields.
>  I am using enctype="multipart/form-data" in the formtag.
>  When I try to get the normal Form.Variables they are not passed to the action
> script.
>
>  But if I take away the <input type = file?> tags it works. In other words the
> <input type = file?> eats my <input name=" " type="text"> variables.
>
>  I do belive this worked in CF 7 but upgraded in the middle of the design so
> not sure.
>  Any one having a solution for this?
>
>  All the best
>
>  Bosse
>
>  <!--- The Form --->
>  <form action="actionProperty.cfm?PropertyID=#PropertyID#&STARTROW=#STARTROW#"
> method="post" enctype="multipart/form-data" name="UpdateProp" id="UpdateProp">
>  <input name="PROVID" type="text" value="#GetMain.SizeM2Land#" size="6" />
>  <input name="ZoneID" type="text" value="#GetMain.SizeM2Const#" size="6"/>
>  <!--- Then the file --->
>  <input name="Img1" type="file" />
>
>  <!--- Then we send it off --->
>  <input name="Submit" type="submit" value="Go.." />
>  </form>
>
>  <!--- If I have all fields in the form I get: --->
>  Variable PROVID is undefined.
>
>  The error occurred in C:\Sites\AlexWonder\HTML\actionProperty.cfm: line 4
>
>  2 : <!--- Variables --->
>  3 : <cfset PropID = #URL.PropertyID#>
>  4 : <cfset ProvinceID =#ProvID#>
>  5 : <cfset ZoneID = #ZoneID#>
>  6 : <cfset SizeM2Land = #Form.SizeM2Land#>
>  No references to form fields what so ever.
>
>  But if I<!--- <input name="Img1" type="file" /> --->
>  It works fine an I get:
>  Variable Form.img1 is undefined
>
>  And
>  Form Fields:
>
>  FIELDNAMES=PROVID,ZONEID,TYPEID,

Try to use full scopes on var names:
2 : <!--- Variables --->
3 : <cfset PropID = #URL.PropertyID#>
4 : <cfset ProvinceID =#form.ProvID#>
5 : <cfset ZoneID = #form.ZoneID#>
6 : <cfset SizeM2Land = #Form.SizeM2Land#>
...
Forms like this work with no problems on my servers...


<Prev in Thread] Current Thread [Next in Thread>