Skip to main content
Inspiring
March 1, 2012
Question

Need Multiple File Uploader Tag

  • March 1, 2012
  • 1 reply
  • 687 views

I know of cffileupload, but it looks like it can not work with other form elements in same form, since its flash based.

Is there any other way to incorporate a multi file uploader tag in a form. cffile only allows for one file upload.

Thanks

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    March 3, 2012

    You could just extend the basic upload for one file to two or more files. Here is an example:

    <cfif isDefined("Form.FileContents") >

        <cffile action = "upload"

            fileField = "FileContents"

            destination = "c:\uploads"

            accept="image/jpeg,image/jpg,image/pjpeg,image/png"

            nameConflict = "overwrite">

        <cffile action = "upload"

            fileField = "FileContents2"

            destination = "c:\uploads"

            accept="application/pdf"

            nameConflict = "overwrite">

            Done uploading files.

    <cfelse>

        <cfoutput><form method="post" action="#cgi.script_name#" enctype="multipart/form-data"></cfoutput>

            <input name="FileContents" type="file">

            <br>

        <input name="FileContents2" type="file">

            <br>

            <input name="submit" type="submit" value="Upload File">

        </form>

    </cfif>