Hi, I just got started in coldfusion and have coldfusion builder 9. I am using FlashBuilder 4 also. I want to make a file upload and don't know how. I would like to use coldfusion to specify how big the file can be and how many can be in the file upload folder.
make a file upload
specify how big the file can be
and how many can be in the file upload folder.
I find it a challenging, and useful, exercise. Here is an example in Coldfusion 9. There are 2 CFM files, multiUpload.cfm and uploadFiles.cfm, within the same directory.
The maximum allowed file size for upload is 2 MB. The maximum number of files that can be uploaded each time is 10.
My upload directory is c:\uploads. It has a limit of 30 files. When the limit is reached, the upload button will disappear.
<cfset MAXUPLOADDIRSIZE = 30>
<cfset isUploadButtonHidden = false>
<cfset maxNoOfFilesSelectedForUpload = 10>
<!--- list the upload dir --->
<cfdirectory action="list" directory="c:\uploads" name="uploadDir">
<cfset noOfFilesinUploadDir = uploadDir.recordcount>
The upload directory currently has #noOfFilesinUploadDir# files.<br>
The limit is #MAXUPLOADDIRSIZE#.<br>
<cfset uploadFolderAllowance = MAXUPLOADDIRSIZE - noOfFilesinUploadDir>
<cfif uploadFolderAllowance LTE 0>
<cfset isUploadButtonHidden = true>
<cfset maxNoOfFilesSelectedForUpload = 0>
<cfelseif uploadFolderAllowance LTE 10>
<cfset maxNoOfFilesSelectedForUpload = uploadFolderAllowance>
hideUploadButton = "#isUploadButtonHidden#"
addButtonLabel = "Add File"
clearButtonlabel = "Clear"
title = "File Upload"
action = "uploadAll"
destination = "c:\uploads"
nameConflict = "overwrite">
In FlashBuilder, which ColdFusion file would I direct it to? Also what script do I use use in FlashBuilder and what ColdFusion code can I use to be able to delete files and show them in FlashBuilder?
I just found out I can't use ColdFusion! My hosting plan doesn't support ColdFusion! Thanks Anyway!
Right now, I have a good hosting plan that supports php so in the mean time, till I get my hosting plan set-up for coldfusion I think i'll just use php.