I can confirm that it didn't work for me. I can't seem to attach a
file so I will copy and paste here but I wrote this to accept a ZIP
file and then add the files contained in it to the library using the
selected category (optional). This requires CF 8.
I think we only used it once, so your mileage may vary. Hope it
helps.
Add to customadmin.xml like so:
<menu label="Bulk File Upload">
<menuitem label="Bulk File Upload" link="/admin/customadmin.cfm?
module=files/bulkUpload.cfm" />
</menu>
Then create a customadmin/files/bulkUpload.cfm like so:
<cfsetting requesttimeout="99999" />
<cfimport taglib="/farcry/core/tags/admin/" prefix="admin" />
<cfimport taglib="/farcry/core/packages/fourq/tags/" prefix="q4">
<cfimport taglib="/farcry/core/tags/widgets/" prefix="widgets">
<admin:header title="Bulk File Upload" />
<cfif structKeyExists(form,'zipFile')>
<!--- upload zip file --->
<cffile action="upload" accept="application/zip,application/x-zip-
compressed" nameconflict="overwrite" destination="#expandPath('/
files/')#" filefield="zipFile" />
<!--- read the zip file --->
<cfzip action="list" file="#cffile.serverDirectory#
\#cffile.ServerFile#" name="qFiles" />
<cfset ZipFilePath = cffile.serverDirectory & '\' &
cffile.ServerFile />
<!--- loop over each file --->
<cfloop query="qFiles">
<cfif type eq 'file'>
<!--- get the file out of the zip file --->
<cfzip action="readBinary" file="#ZipFilePath#"
entrypath="#directory##name#" variable="thisFile" />
<!--- copy it to the /files/dmFile folder --->
<cffile action="write"
file="#expandPath('/files/dmFile/')##name#"
output="#thisFile#" />
<!--- add new dmFile object --->
<cfset theFile = structNew() />
<cfset theFile.objectid = createUUID() />
<cfset theFile =
createObject('component',application.types.dmFile.typePath).getData(theFile.objectid)
/
>
<cfset theFile.title = name />
<cfset theFile.label = name />
<cfset theFile.description = name />
<cfset theFile.documentDate = now() />
<cfset theFile.status = 'approved' />
<cfset theFile.createdBy = session.dmProfile.username />
<cfset theFile.ownedBy = session.dmProfile.objectid />
<cfset theFile.fileSize = size />
<cfset theFile.filename = '/dmFile/' & name />
<cfset theFile.fileExt = right(name,3) />
<cfset theFile.catFile = '' />
<cfif structKeyExists(form,'lSelectedCategoryID')>
<cfloop list="#form.lSelectedCategoryID#"
index="catid">
<cfset theFile.catfile =
listAppend(theFile.catFile,catid) />
</cfloop>
</cfif>
<cfset theFile.filepath = '' />
<cfset theFile.fileType = '' />
<cfset theFile.fileSubType = '' />
<q4:contentobjectdata
typename="#application.types.dmFile.typePath#"
stProperties="#theFile#" objectID="#theFile.objectID#">
</cfif>
</cfloop>
<cfoutput><p>Uploaded #qFiles.recordcount# files.</p></cfoutput>
<cftry>
<cffile action="delete" file="#ZipFilePath#" />
<cfcatch type="any">
<cfoutput><p>Couldn't delete the zip file. Manually
delete it:
#ZipFilePath#</p></cfoutput>
</cfcatch>
</cftry>
</cfif>
<cfform enctype="multipart/form-data" action="" method="post">
<p><widgets:categoryAssociation typeName="dmFile"
lSelectedCategoryID=""></p>
<p><label for="zipFile">Zip File:</label> <cfinput required="true"
message="Please provide the zip file" type="file" name="zipFile"
id="zipFile" /> <input type="submit" id="cmdSubmit" value="Upload" /></
p>
</cfform>
<admin:footer />
On Oct 6, 8:16 pm, modius <[EMAIL PROTECTED]> wrote:
>
> Can anyone confirm a working "builk file" uploader on 4.x.x?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---