• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Sep 01, 2014 Sep 01, 2014

Copy link to clipboard

Copied

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 ...

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 02, 2014 Sep 02, 2014

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.

Votes

Translate

Translate
Community Beginner ,
Sep 01, 2014 Sep 01, 2014

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2014 Sep 02, 2014

Copy link to clipboard

Copied

DharameshShrivastava wrote:

<!-- start -->

<!--  -->

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

<!--- start --->

<!---  --->

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 02, 2014 Sep 02, 2014

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2014 Sep 02, 2014

Copy link to clipboard

Copied

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

I am looking in detail into the code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2014 Sep 02, 2014

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2014 Sep 07, 2014

Copy link to clipboard

Copied

thanks BKBK.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2014 Sep 07, 2014

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation