Skip to main content
DharameshShrivastava
Participating Frequently
Sep 1, 2014 5:13 PM UTC
Answered

please Help me in solving this issue. i am a newbie to coldfusion

i want to use a single home page where i will show a form (which is in another file) to user to upload a file,after uploading (action file result) i want to show result of upload also on the same page.

these are my three files:

1. index.cfm

<!-- start -->

<html>

<head>

<title>HomePage</title>

<cfajaximport tags="CFFORM">

</head>

<body>

<cfdiv id="Main" style="width:1000px; height:600px" >

        <cfdiv id="Options" style=" width:100%;height:20%" >

            Welcome Admin, <a href="javascript:ColdFusion.navigate('FileUpload.cfm','Content')" class="settings">Update  </a><a href="#" class="logout">Logout</a>

        </cfdiv>

        <cfdiv id="Content" style=" width:100%;height:80%">

<h2>Here Goes Form and FileUploading</h2>

        </cfdiv>

</cfdiv>

</body>

</html>

<!--  -->

2.FileUpload.cfm

<!-- start -->

<html>

    <head>

        <title>

            Upload A File

        </title>

    </head>

    <body >       

<cflayout type="vbox" name="layout1">

<cflayoutarea>

    <cfform  enctype="multipart/form-data"  action="FileReceiver.cfm" >

           

                        File To Upload:

           

                        <cfinput type="file" name="Filename" size="50" >

             <br/>       

                        <cfinput type="submit" name="UploadFile" value="UPLOAD THIS FILE">

                <br/>

                  

               

        </cfform>

</cflayoutarea>

<cflayoutarea>       

    <table border="1" >

            <tr>

            <th >

                Directory Information

            </th>

            </tr>

            <tr>

                <td>

                <cfoutput >

                    CurrectDirectory Path: #getdirectoryFromPath(expandPath("index.cfm"))#

                </cfoutput>

                </td>

            </tr>

        </table>

</cflayoutarea>

</cflayout>

   

    </body>

</html>

<!-- -->

3.FileReceiver.cfm

<!---start-->

<cfif isdefined('UploadFile')  >

<cfoutput >

<cffile nameconflict="makeunique"

action="upload"

filefield="Form.Filename"

destination="#getdirectoryFromPath(expandPath("index.cfm"))#" > <!--- or destination="c:\Upload\"--->

        File upload was successful!

</cfoutput>

</cfif>

<!-- -->

when i click on "update link" index page shows the FileUpload.cfm page in one of its container but while uploading file

i always get ERROR MESSAGE:

Error retrieving markup for element cf_layoutarea736558924094373 : Invalid content type: application/x-www-form-urlencoded; charset=UTF-8. [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

Kindly Help me doing it right...i am unable to figure out problem ...

    This topic is closed to new replies. Start a new post to keep the conversation going.
    BKBK
    BKBKCorrect answer
    Community Expert
    Sep 2, 2014 2:13 PM UTC

    Ah, I found the cause of the issue: Coldfusion stores the properties of user-interface tags like cfdiv and cflayoutarea in the form scope. That is what is destroying your upload form. To see it, run the following test code:

    <cfdump var="#form#">

    <cflayout type="vbox" name="layout1">

    <cflayoutarea name="myLayoutArea123">

    <cfform >

    <cfinput type="submit" name="submit" value="Test by posting form to same page.">

    </cfform>

    </cflayoutarea>

    </cflayout>

    Now, the search for a possible solution.

    7 replies

    DharameshShrivastava
    Participating Frequently
    Sep 7, 2014 12:24 PM UTC

    thanks BKBK.

    i replaced cfform and cfinput with form and input... then i worked....

    Translate
    BKBK
    Community Expert
    Community Expert
    Sep 7, 2014 1:32 PM UTC

    Thanks for sharing. Please mark it as the correct answer, so as to help someone else in future.

    Translate
    BKBK
    Community Expert
    Community Expert
    Sep 2, 2014 8:35 AM UTC

    DharameshShrivastava wrote:

    <!-- start -->

    <!--  -->

    These are not Coldfusion comments. Replace them, respectively, with

    <!--- start --->

    <!---  --->

    Translate
    DharameshShrivastava
    Participating Frequently
    Sep 2, 2014 12:51 PM UTC

    Okay...i kept these here only to separate codes of 3 files for better visibility...

    but what is the issue with this code, why it shows error? i am still clue less...any suggestion?

    Translate
    BKBK
    Community Expert
    Community Expert
    Sep 2, 2014 1:17 PM UTC

    Suggestion after a quick browse: <cfajaximport tags="cfform,cfdiv,cflayout-tab">. Does that have any effect?

    I am looking in detail into the code.

    Translate
    DharameshShrivastava
    Participating Frequently
    Sep 1, 2014 7:30 PM UTC

    Answer plz.... these are small files.... but i can not figure out exact problem/solution

    Translate