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

cffileupload - JSON return causing error

New Here ,
Aug 12, 2010 Aug 12, 2010

Copy link to clipboard

Copied

I have a page has the cffileuload tag.

The process page simply moves the file to a new location and returns the JSON stuct.

<cfset str.STATUS = 200>

<cfset str.MESSAGE = "passed">

<cfoutput>#serializeJSON(str)#</cfoutput>

When I run the page I get a red bar error (no number) on the first file and the uploading stops.  However the actual file does move so it is being processed.

When I comment out the str.STATUS = 200 everything seems to work fine.

I don't have much understanding of AJAX but I was under the assumption that the STATUS 200 was feedback to the uploader that the page has successfully run.

According to the documentation I need to output the JSON as above. 

Any help would be appreciated.

Running: CF9.0.1

TOPICS
Advanced techniques

Views

1.1K

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
Guest
Aug 16, 2010 Aug 16, 2010

Copy link to clipboard

Copied

LATEST

I'm having the same problem. All the examples I've found say that the upload handler should return the following JSON (using your own appropriate values):

<cfset str.STATUS = 200>
<cfset str.MESSAGE = "This is a message.">

<cfoutput>#serializeJSON (str)#</cfoutput>

but I get an error... the progress bar turns red and when I output the results of the onComplete js function, I get

Status: [500], message: [Error], file: [temp.txt]

output comes from the onComplete function (onComplete="uploadFilesComplete"):

function uploadFilesComplete (file) {

     var msg = '<p>Status: [' + file.STATUS + '], message: [' + file.MESSAGE + '], file: [' + file.FILENAME + ']</p>';
     var obj = document.getElementById ('upload-results');
     if (obj)
          obj.innerHTML = obj.innerHTML + msg;
}


But if I don't return any output, I get:

Status: [200], message: [Success], file: [temp.txt]

I wonder if this worked in CF 9.0, but was recently broken in CF 9.0.1. I just ran into another problem after updating to CF 9.0.1 (AJAX cflayoutarea broken) here:

http://forums.adobe.com/message/3057005

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