I'm trying to upload multiple files to the server from a form with multiple file
buttons.  The code for the upload is below.  I have a couple of problems.

- I receive an error from Safari (not IE, or Firefox): Safari can’t open the 
page
“http://hhp.umd.edu/dean/notes/additem.cfm”. The error was: “POSIX error: 
Is
a directory” (NSPOSIXErrorDomain:21)

- so in the code, I check the file size.  I grabbed this code from something I 
did
years ago, but it uploaded one file.  I don't see the file name designated where
the file size is checking.  Which file then is it checking?  Or more a practical
question is how do I get it to check the file that's currently uploading?  It 
may be
for all I can tell.

------------  code  --------------
<cfloop from="1" to="#Form.fileCount#" index="uf">
       <cfset the_file_field = evaluate('form.take_aways_#uf#')>
       <cfif NOT structKeyExists(form,'take_aways_#uf#') OR the_file_field EQ 
''>
               <cfset the_file_field = "">
       <cfelse>
               <!--- Check that the directory exists to avoid getting an error
message. --->
               <cfset newDirectory = listlast(listfirst(session.user.dn),"=")>
               <cfset currentDirectory = 
GetDirectoryFromPath(GetTemplatePath()) &
"note_files/#newDirectory#">

               <!--- Check to see if the Directory exists --->
               <cfif NOT DirectoryExists(#currentDirectory#)>
                   <cfdirectory action = "create" directory = 
"#currentDirectory#" >
                   <cfoutput><p>Your directory has been created.</p></cfoutput>
                   <cfelse>
                   <cfoutput><p>Your had a directory.</p></cfoutput>
               </cfif>
               <cfoutput>#currentDirectory#</cfoutput>
               <!--- check the CGI environment variable Content_Length to make
sure the file being uploaded is less than 1 MB in size.  If it is not, halt
processing --->

               <CFIF Val(CGI.CONTENT_LENGTH) GT 1048576>
               <p class='md_red_font'>The file is too large.  The image file 
must be
1 megabyte or smaller.
               <a href='javascript:history.go(-1);'>BACK</a>.
               </p>
               <cfelse>                    
                   <cftry>
                       <cffile
                       action="upload"
                       filefield="Form.take_aways_#uf#"
                       destination="#currentDirectory#"
                       nameconflict="MakeUnique">
                   
                   <!--- if an unauthorized file type upload is attempted --->
                   <cfcatch type="Any">
                       <cflocation 
url="notes.cfm?fileuploaderror=true&msg=#cfcatch.message#" addtoken="No">
                   </cfcatch>
               </cftry>
     <cfset the_file_field ='#CFFILE.serverFileName#.#CFFILE.ServerFileExt#'>
               </CFIF>
       </cfif>
</cfloop> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258172
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to