Php 移动文件和将文件数据保存为空白时出现问题

Php 移动文件和将文件数据保存为空白时出现问题,php,jquery,mysql,ajax,upload,Php,Jquery,Mysql,Ajax,Upload,我这里有些问题 我使用index.php上的upload和jquery(ajax)将任何信息保存到mysql。我有3个文件index.php、savedata.php和jsSave.js $(document).ready(function() { $('#imgLoad').hide(); $('#msgConfirm').hide(); $('#tblAvailabilityResult').hide(); }); $(function() { $(

我这里有些问题

我使用index.php上的upload和jquery(ajax)将任何信息保存到mysql。我有3个文件index.php、savedata.php和jsSave.js

    $(document).ready(function() {
    $('#imgLoad').hide();
    $('#msgConfirm').hide();
    $('#tblAvailabilityResult').hide();
});

$(function() {  
  $("#butTblSave").click(function() {  
        $.ajax({
        type: 'POST',
        url: 'saveData.php',
        data: $('form').serialize(),

            beforeSend: function() {
                $("imgLoad").show();
            },

            complete: function() {
                $("imgLoad").hide();
            },        

            cache: false,

            success: function () {

                $("#cItemPicture").val('');

                $('#imgLoad').hide();
                $('#butTblSave').attr("disabled", false);

                $('#msgConfirm').fadeIn(500).delay(5000).fadeOut(1000);
                $("#msgConfirm").html(' Add New Item Success.');

            }

        });
        return false;
    }

  });  
});  
但当我使用savedata.php中的$\u请求文件,结果在mysql表中也是空白响应时,我替换了$\u请求并使用了$\u文件,得到了相同的结果

我已经尝试使用的代码如下所示

Index.php

        <form class="myform" action="<?php $_SERVER['PHP_SELF'];?>" method="POST" name="myform" id="myform" enctype="multipart/form-data" style="width:350px;">

                            <li>
                            <label>Item Picture</label>
                            <div class="fileUpload btn btn-primary">
                                <span>Choose Image..</span>
                                <input type="file" name="cItemPicture" class="cItemPicture" id="cItemPicture"/>
                            </div>
                            <input type="hidden" name="cPic" id="cPic"/>
                        </li>

                        <li>
                            <img border="0" src="images/loading_transparent.gif" width="20" height="20" id="imgLoad">
                        &nbsp<button class="button_blue" id="butTblSave" type="submit" style="width: 81px; height: 33px">SAVE</button>
                        </li>
我错过什么了吗?当按下SAVE按钮时,ajax响应为空,将数据保存到mysql项目中,图像也为空,并且没有文件移动到上传文件夹中

对这个问题有什么想法吗?非常感谢


谢谢

尝试阻止默认提交表单。 因为表单正在提交给SELF(index.php)


我的意思是,如何在savedata.php中获得文件上传值?使用$_文件[“cItemPicture”][“name”];我尝试使用$\u请求,但仍然没有任何结果
    $(document).ready(function() {
    $('#imgLoad').hide();
    $('#msgConfirm').hide();
    $('#tblAvailabilityResult').hide();
});

$(function() {  
  $("#butTblSave").click(function() {  
        $.ajax({
        type: 'POST',
        url: 'saveData.php',
        data: $('form').serialize(),

            beforeSend: function() {
                $("imgLoad").show();
            },

            complete: function() {
                $("imgLoad").hide();
            },        

            cache: false,

            success: function () {

                $("#cItemPicture").val('');

                $('#imgLoad').hide();
                $('#butTblSave').attr("disabled", false);

                $('#msgConfirm').fadeIn(500).delay(5000).fadeOut(1000);
                $("#msgConfirm").html(' Add New Item Success.');

            }

        });
        return false;
    }

  });  
});  
$("#butTblSave").click(function(event) { 
event.preventDefault();
...