I found a neat little way of checking a file size before full upload in CF by using Java io. In Java the following "file.length();" will get the number of bytes in the file. In CF you can do this...
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
createObject("java","java.io.File").init("image.png").length()
1createObject("java","java.io.File").init("image.png").length()
So something like this is neat and tidy.
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
if (createObject("java","java.io.File").init("image.png").length() gt xx)
return false;
else
fileUpload("D:\","#arguments.image#","","makeUnique");
1if (createObject("java","java.io.File").init("image.png").length() gt xx)
2 return false;
3 else
4 fileUpload("D:\","#arguments.image#","","makeUnique");
There are of course many other ways of doing this, but simple things like this impress me.
19/09/11 15:09
How can Java on the server get the file size of a file on the user's machine?