Copy link to clipboard
Copied
HIya,
Is there a way to stop this somehow using CF?
Thankyou
Copy link to clipboard
Copied
NOPE!
ColdFusion isn't told about the image until after the browser has sent it and the web server has received it and put it into a temp directory.
The only hope you have to stopping this is with some client side tool in something like JavaScript or Flash that intercepts the file before it is uploaded.
Just yesterday I was saying: http://forums.adobe.com/message/2450093#2450093
Copy link to clipboard
Copied
Hi,
But CF9's new <cffileupload> tag provides a way to limit this maxlimit,
Refer the documentation here,
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec18238-7fd0.html
Copy link to clipboard
Copied
Man, I really need to kick my operations guy to get him in gear and get the Virtural Server setup so I can start playing with ColdFusion 9!!!
To be clear, just reading that documentation, that tag is going to build some type of Flash and|or JavaScript User interface that will run on the client. , but it is doing so with a neat little tag just like the other cfform tags can create quite sophisticated dhtml or flash form interfaces.
But I really do want to start using the cool new toys.
Copy link to clipboard
Copied
Yes Ian!.. Even I tried a demo of <cffileupload> here, and it looks very handy comparing to the older ways of uploading things.
I hope you will like CF9's new ORM built-in functionality as well. :-).
Happy Coding 🙂 ...
Copy link to clipboard
Copied
The document in that link did not say if the validation was happening on the client or server. It could be the server.
I remember a similar question regarding client size validation of image sizes. My vague recollections are that it could not be done with javascript but that it could be done with Active X. However, using Active X would either be blocked by the browser, or the user would be prompted to allow the script to run.
Copy link to clipboard
Copied
Hi Dan,
I think it is a client side validation.
It uses the "cffileupload.js" file for validating the parameters, and the below snippet of that file clearly suggests that it is a client side validation.
if(this.inpFields.getCount()>this.maxFileSelect){
Ext.MessageBox.alert("Number exceed","Total File can be uploaded should not be more than"+this.maxFileSelect);
return;
}
Copy link to clipboard
Copied
I have not played with it much. But I believe it is flash/flex control (which can check file sizes before upload). So my guess would be client side validation as well.
-Leigh
Copy link to clipboard
Copied
The code snippet is for number of files. The discussion topic is file size. I don't have cf9 so I can't read my own copy of that file.
Copy link to clipboard
Copied
Oops... Sorry dan.. Infact that was a wrong snippet,
Here is the correct one,
Ext.DomHelper.append(fileuploadObj.formEl,{tag:"input",type:"hidden",name:"MAX_FILE_SIZE",value:"1000000"});
Copy link to clipboard
Copied
That looks like it adds stuff to the html source code which will then be transferred to the server. But then again, the most significant thing I know about js is that I am not very good at it.
It's easy enough to test. Write a simple page and look at the html source code. Next, you could try to run it and see if the feedback is instantaneous. If it is, it is likely that the validation occurred on the client.
Copy link to clipboard
Copied
Ext.DomHelper.append(fileuploadObj.formEl,>
);
Daverms,
Just curious, but where are you seeing this? I am seeing that values are passed to a swf via cffileupload_swf.js. So the validation is almost certainly handled by flash (client side).
-Leigh
Copy link to clipboard
Copied
Hi Leigh,
Its in the "cffileupload.js" (30th line) located under "wwwroot\CFIDE\scripts\ajax\package" directory.
Thanks.
Copy link to clipboard
Copied
Hi Daverms (or is it Dave? :),
I must be caffeine deprived, because I am not seeing a "cffileupload.js" file. Just "cffileupload_swf.js" (CF 9,0,0,251028)
Here is the view source from a single <cfffileupload>. I checked and the max file size is passed to the swf from within cffileupload_swf.js.
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/messages/cfmessage.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/package/cfajax.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/animation/animation-min.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/ext/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/ext/ext-all.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/package/cffileupload_swf.js"></script>
<link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/resources/ext/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/resources/cf/cf.css" />
<link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/resources/cf/uploadfile.css" />
<script type="text/javascript">/* <![CDATA[ */
ColdFusion.Ajax.importTag('CFFILEUPLOAD');
/* ]]> */</script>
<script type="text/javascript">/* <![CDATA[ */
var _cf_fileupload_init_1260471177766=function()
{
var _cf_fileupload=ColdFusion.FileUpload.create('myupload','http://127.0.0.1:8502/test/uploadFiles.cfm','Add File','Clear it','Upload now',null,'File Upload',10,1048576,null,null,null,600,400,'#FFFFFF',null,null,null,null,null,null,null,true,'/',true,true,null,'left');
};ColdFusion.Event.registerOnLoad(_cf_fileupload_init_1260471177766);
/* ]]> */</script>
<div id="myupload" style="text-Align:left;">
</div>
Copy link to clipboard
Copied
Hi Leigh,
Sent you a private message.. Please check.