/product.cfm Secret
Last active
February 18, 2016 04:25
CF Upload Multiple Files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="productupload.cfm" enctype="multipart/form-data" name="upload_form" method="post"> | |
<input type="file" name="upfile1"> (Main) | |
<input type="file" name="upfile2"> (photo 2) | |
<input type="submit" class="button blue medium" name="upload" value="Upload Photos" onclick="document.upload_form.upload.value='Please wait...';document.upload_form.upload.disabled=true;document.upload_form.submit();"> | |
<input type="button" class="button white medium" value="Reset" onclick="document.upload_form.upload.disabled=false;document.upload_form.upload.value = 'Upload Photos';"> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfinclude template="../template/currentpath.cfm"> | |
<cftry> | |
<cffile action="uploadall" destination="#currentpath#" accept="image/jpeg, image/gif, image/png" nameconflict="makeunique"> | |
<cfset accepted="true"> | |
<cfcatch type="any"> | |
<cfset accepted="false"> | |
</cfcatch> | |
</cftry> | |
<cfif accepted> | |
<cfdump var="#cffile#"> | |
<cfabort> | |
<cfelse> | |
... | |
</cfif> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfinclude template="../template/currentpath.cfm"> | |
cfloop index = "i" from = "1" to = "1"> | |
<cfif len(trim(form.upfile#i#)) gt 0> | |
<cftry> | |
<cffile action="uploadall" destination="#currentpath#" accept="image/jpeg, image/gif, image/png" fileField="form.upfile#i#" nameconflict="makeunique"> | |
<cfset accepted="true"> | |
<cfcatch type="any"> | |
<cfset accepted="false"> | |
</cfcatch> | |
</cftry> | |
<cfif accepted> | |
do some process | |
<cfelse> | |
put out error | |
</cfif> | |
</cfif> | |
</cfloop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment