Frage

I have implemented FileUploader 4.4 and it works perfectly when uploading multiple files using Coldfusion.

The end point code is very simple and looks like this:

<cffile action="upload"
                destination="#application.Config.imageDir#"
                nameconflict="overwrite" 
                filefield="FORM.qqFile" />
            <cfif CFFILE.contenttype EQ "image" OR ListFindNoCase("jpg,jpeg,gif,png", CFFILE.serverFileExt)>
                <cfset local.fileName = CFFILE.serverFile />
</cfif>

Whenever I upload single, or multiple images, the local.filename variable is correctly set to the image file name value that you usually see in qqfilename, for example "image0001.jpg"

The javasript code to send this data is simply:

 $('#fine-uploader').fineUploader({
             request: {
                endpoint: '<cfoutput>#application.Config.fineUploaderProxy#?cfc=#cfcName#&functionName=#functionName#</cfoutput>'
              }
    });

However, as soon as I add scaling, then a strange behaviour starts occurring. The scaled version is sent to my upload handler, however, the file name that is being sent is always "blob" for every scaled image, instead of the name I would expect, being something like "image0001(small).jpg"

The code I add to activate the scaling is simply:

 $('#fine-uploader').fineUploader({
            scaling: {
                    sizes: [
                        {name: "small", maxSize: 50}
                    ]
                },
            request: {
                endpoint: '<cfoutput>#application.Config.fineUploaderProxy#?cfc=#cfcName#&functionName=#functionName#</cfoutput>'
              }
    });

Could someone please help me as to why the filename "blob" is being with the qqfile instead of the actual file name? I am using the latest version of Chrome.

Thanks

War es hilfreich?

Lösung

This is due to the fact that Fine Uploader doesn't actually send a File when it generates a scaled version off a reference file. The entity is specifically a Blob. While a File has a name property, a Blob does not. It is because of this that the browser, when constructing the multipart segment for a Blob, sets the filename parameter to "blob". There are ways to overcome this, but not reliably cross browser. So, Fine Uploader will always send the actual file name in a "qqfilename" parameter. Your server should look at this value to reliably determine the files name in all cases.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top