After $.ajaxFileUpload uploads the file, the backend returns the result. If you press the button again, the value of Filedata disappears.

$.ajaxFileUpload uploads the file, and the backend returns the result. If you press the button again, the value of Filedata disappears. Only IE11 has an exception. There is nothing wrong with other browsers.

  • html
                    <div class="dialog-body">
                        <dl class="list-table list-table-input-text list-table-180">
                            <dt style="width:70px;"><span style="color:red;">*</span></dt>
                                <dd>
                                    <form enctype="multipart/form-data" id="replyUploadFile" name="replyupload_file">
                                        <input type="file" id="replyBrowse" name="Filedata" style="display: none" accept="application/x-zip-compressed">
                                        <input type="hidden" id="contentsDirUrl" name="contentsDirUrl" value="" />
                                        <input type="hidden" id="courseNo" name="courseNo" value="<cfoutput>-sharpssoCourseNo-sharp</cfoutput>" />
                                        <input type="hidden" id="courseName" name="courseName" value="<cfoutput>-sharpssoCourseName-sharp</cfoutput>" />
                                        <input type="hidden" id="userID" name="userID" value="<cfoutput>-sharpssoUserID-sharp</cfoutput>" />
                                        <input type="hidden" id="courseTime" name="courseTime" value="<cfoutput>-sharpssoCourseTime-sharp</cfoutput>" />
                                        <input type="hidden" id="smartPhoneFlag" name="smartPhoneFlag" value="<cfoutput>-sharpssoMoileFlag-sharp</cfoutput>" />
                                        <input type="hidden" id="company" name="company" value="<cfoutput>-sharpssoCompany-sharp</cfoutput>" />
                                        <input type="hidden" id="memberCompany" name="memberCompany" value="1" />
                                        <input type="text" id="replyFilename" style="width:200px;" readonly />
                                        <button type="button" id="replySelectFileButton" class="btn" style="float:right;"></button>
                                    </form>
                                </dd>
                            <dt></dt>
                                <dd id="replyFilesize" style="padding-top:6px;"></dd>
                            <dt></dt>
                                <dd></dd>
                        </dl>
                    </div>
  • js
        $.ajaxFileUpload({
            type: "POST",
            url: getParentPath(3) + "bin-debug/cfm/ssouploadTeachingMaterial.cfm",
            data: {
                contentsDirUrl: getParentPath(3) + "bin-debug/contents",
                scormVersion: "1.2",
                smartPhoneFlag: smartPhoneFlag,
                courseNo: courseNo,
                userID: userID,
                courseTime: courseTime,
                memberCompany: 1,
                company: company

            },
            cache: false,
            fileElementId: "replyBrowse",
            secureuri: false,
            scriptCharset: "UTF-8",
            dataType: "json",
            complete: function() {
                var result = sessionCfc.getSessionSsoRunResult();
                var msg = sessionCfc.getSessionSsoRunMsg();
                if (result) {
                    successmessageDialog.open();
                } else {
                    $("-sharperror").text(msg);
                    errormessageDialog.open();
                }
            }
        });
  • background code
<cftransaction>
    
    <cftry>
    <cflog text="form.Filedata:-sharpform.Filedata-sharp  ; form.scormVersion: -sharpform.scormVersion-sharp" />
    <cfif (StructKeyExists( form, "Filedata" ) AND form.Filedata NEQ "") AND (StructKeyExists( form, "scormVersion" ) AND form.scormVersion NEQ "") AND (StructKeyExists( form, "contentsDirUrl" ) AND form.contentsDirUrl NEQ "") AND (StructKeyExists( form, "smartPhoneFlag" ) AND form.smartPhoneFlag NEQ "")>    
        <cflog text="111111111111" />
        <cfset smartPhoneCheck = form.smartPhoneFlag />    
        <!--- LMS --->
        <cfquery name="queryGetLmsInfo" datasource="-sharpapplication.DSN-sharp">
            SELECT * 
            FROM lms_info  
        </cfquery>
May.07,2021

did not find the reason, change it to another way to implement

Menu