"What issues and limitations exactly? Had no problems using jQuery with it -
though that uploadify looks like a better js implementation for sure."
There is no issues it's just not as "clean". It's also harder to control the
data coming back. I just went through most all the ajax uploads and thought I
settled on swfupload then when getting towards the finish line I started
running into limitations but can't recall what they were exactly since I went
through so many. I ended back with uploadify I think because I could hack the
source easier to control the error messages. Most of these don't have flexible
error reporting and if there is 1 thing I know about clients and uploadsâ¦
they need error reporting!
@rick
I have it set to 1 at a time but it can do multiples. The reason I do that is
clients screw up multi ones way to easy and I want to be more in control of
data . Most people want to make this a one shot deal and I don't think thatâs
right, I think it is a multi-step process that should be handled that way. So
uploading a file is 1 process, cleaning, resizing, etc is another process &
submitting it to db is another process. This gives so much more control over
how things are done and error prevention and reporting
"Then, within the cfc method, I loop over the images and process each one."
With how I do it would be easy but messy.
?I'm looking for some way to send a message back after each image is
processed.?
I', going to send info back as each step is processed.. checking for virusâ¦.
pass, checking mime type.. pass, checking size.. pass, resign large web
image⦠done creating thumbnail⦠done
"Could I use writeOutput(SerializeJSON(result)); multiple times with a
method?"
yes or you could just use <cfoutput> and output it if not using cfscript.
""And is the code that starts with "if(ckMimeTypeObj.status == 0) {"
javascript
or cfscript?  I guess it's got to be cfscript with "createObject...." in it"
that's cf code inside cfscript tags
Here's what I did, I have a cf. called img_util.cfc and in it i put all the
functions I need for the site that have to do with uploading and of course give
each it's own method. Then I make a cf. for every instance of uploading that I
need and then fill it with the methods I want do with that uploader. For
example an image uploader needs different things done to it compared to a zip
file uploader, get me drift?
so this code is inside my cfscript tag (it goes around a lot but will wrap it
here just for show, the code calls the img_util cf. and selects the ckMimeType
method:
<cfscript>
ckMimeTypeObj = createObject("component","img_util").ckMimeType(
ckFile = locFile,
allowedMimeTypes = variables.attributes.allowedMimeTypes
);
</cfscript>
-----------------------------------------------------------------------------------------------------
ckMimeTypeObj: this calls the img_util cf. and you can use this as the return
ckMimeType: method I want in img_util
ckFile: this is the file I am checking and name was assigned prior to this step
allowedMimeTypes: gets the mimes I have passed in in ajax form in hidden field
This code processes what the img_util method passes back, I pass it in in son
variable named results:
if(ckMimeTypeObj.status == 0){
result.status = ckMimeTypeObj.status;
result.message = ckMimeTypeObj.message;
writeOutput(SerializeJSON(result));
abortObj = createObject("component", "cfc.utilities").abort();
} else {
result.status = ckMimeTypeObj.status;
result.message = ckMimeTypeObj.message;
}
---------------------------------------------------------------
if(ckMimeTypeObj.status == 0: im my method if there is an error I set
result.status to 0, if it's ok I set it to 1. So this code says that it the
result.status variable passed back is 0 then add the status & error message
back to the script by outputting the results back to the script and then the
abort is in a custom cf. I have that makes it so I can use abort in cfscript
which will be in cf9.
if the results came back as
if(ckMimeTypeObj.status == 1
then the script would set the variables it got back and move on to the next
step. It will eventually have an output to report this step back though and all
I need for that is to add a writeoutput
} else {
result.status = ckMimeTypeObj.status;
result.message = ckMimeTypeObj.message;
}
would become
} else {
result.status = ckMimeTypeObj.status;
result.message = ckMimeTypeObj.message;
writeOutput(SerializeJSON(result));
}
Just so you can see what's all going on here is the ckMimeType method from
img_util
<!---
****************************************************************************************************
CHECK THE FILES MIME TYPE
get and check files mime type
****************************************************************************************************
--->
<cffunction name="ckMimeType" access="public" output="false"
hint="Returns the mime type of the file">
<cfargument name="ckFile" type="string" required="true">
<cfargument name="allowedMimeTypes" type="string"
required="true">
<cfscript>
var fileCheck = lcase(arguments.ckFile);
var allowedMimeTypes = arguments.allowedMimeTypes;
var doMimeck =
getPageContext().getServletContext().getMimeType(fileCheck);
if(!FindNoCase(doMimeck, allowedMimeTypes)){
if(fileExists(fileCheck)) {
fileDelete(fileCheck);
}
result.status = 0;
result.message = "The file type " & doMimeck &
" is not allowed";
} else {
result.status = 1;
result.message = "Mime passed";
}
return result;
</cfscript>
</cffunction>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326298
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4