JQuery Form eklentisi kullanarak Internet Explorer'da dosya upload edemez

4 Cevap php

PHP ile birlikte bir dosya yüklemek için JQuery Form Plugin kullanıyorum, her şey Firefox'ta mükemmel çalışıyor, ama ben formu göndermeniz Internet explorer şey yapmaz edilir.

Benim kod aşağıda

<script type="text/javascript">
    <!--
    $(document).ready(function() { 
        var options = {
    	target: '#message',
    	url:'../includes/ajax/import.php?import=1',
    	beforeSubmit: function() {
    	    $('#uploader').html('<div style="padding-top:10%"><center><img src="../domain/images/ajax-loader.gif" border="0" /></center></div>');
    	    $('#message').toggle();
    	},
    	success:  function() {
    	    $("#message").removeClass("message").addClass("messageResponse");
    	    $('#message').toggle();
    	    $('#uploader').html('');
    	}
        };
        $('#upload').ajaxForm(options);

    }); 


    //-->
</script>

<div id="message" class="message">
    <form name="upload" id="upload" action="#" method="POST" enctype="multipart/form-data">
        <table cellpadding="4" cellspacing="4" border="0">
            <tr>
                <td colspan="3"><h1>Map Clients <i>(Import CSV File)</i></h1></td>
            </tr>
           <tr>
                <td class="fieldLabel" nowrap>File:</td>
                <td nowrap><input type="file" name="fileToUpload" id="fileToUpload" />&nbsp;*</td>
                <td nowrap id="errorFile" class="error"></td>
            </tr>
            <tr>
                <td nowrap colspan="3"><button id="mapClients">Map Clients</button></td><td nowrap id="errorFile" class="error"></td>
            </tr>   
        <tr>
    	<td colspan="3"><input type="hidden" value="1" id="type" name="type" /></td>
        </tr>
        </table>
    </form>
</div>
<div id="uploader"></div>

Şimdi benim sorunum IE 7 şey yapmıyor neden gönder düğmesine benim form tıkladığınızda bilemiyorum olabilir

4 Cevap

Ben sorunu buldum

Benim HTML ben böyle bir şey vardı

        <tr>
            <td nowrap colspan="3"><button id="mapClients">Map Clients</button></td><td nowrap id="errorFile" class="error"></td>
        </tr>

Ben bunu değiştirdi

        <tr>
            <td nowrap colspan="3"><input type="submit" id="mapClients" value="Map Clients" /></td><td nowrap id="errorFile" class="error"></td>
        </tr>

Ve sorun çözüldü

Ben aynı sorun haline çalışan hatırlamak görünüyor. Bu deneyin:

$(document).ready(function() { 
    var options = {...
    /*abridged for clarity*/

    $('#upload').submit(function() {
        $(this).ajaxSubmit(options);
        return false;
    });
});

Ben IE8 JQuery Form Plugin ile bir sorun vardı. "Ajax formu" başladı kod parçası ana sayfaya daha sonra güncellenmiş bir "dinamik div" yer oldu. Ana sayfaya bu çağrı taşıma ie8 benim için çalışma var.

De IE ile benzer bir sorun vardı. Ben (kozmetik ve kullanılabilirlik nedenlerle) beforeSend dosya giriş elemanı (input [type = file]) devre dışı çünkü benim durumumda problem oluyordu. Sadece IE giriş elemanı devre dışı olan bir sorun vardı.