Skip to content

Instantly share code, notes, and snippets.

@misterdai
Created July 1, 2010 12:20
Show Gist options
  • Save misterdai/459880 to your computer and use it in GitHub Desktop.
Save misterdai/459880 to your computer and use it in GitHub Desktop.
Retrieves upload information without using CFFile
<cfscript>
function getUploadData() {
var local = {};
local.result = {};
if (cgi.request_method Eq 'post') {
local.uploads = form.getPartsArray();
if (StructKeyExists(local, 'uploads')) {
local.count = ArrayLen(local.uploads);
for (local.u = 1; local.u Lte local.count; local.u++) {
local.info = GetFileInfo(form[local.uploads[local.u].getName()]);
local.result[local.uploads[local.u].getName()] = {
tempFileName = form[local.uploads[local.u].getName()],
originalName = local.uploads[local.u].getFileName(),
contentType = local.uploads[local.u].getContentType(),
filesize = local.info.size,
ext = ListLast(local.uploads[local.u].getFileName(), '.')
};
}
}
}
return local.result;
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment