因为不能上传图片到storage上,所以简单做了个测试。发现storage.php没有返回值。代码如下。
test.php
<script type="text/javascript" src="js/jquery-2.1.1.min.js" ></script>
<script type="text/javascript" src="js/ajaxfileupload.js" ></script>
<script type="text/javascript">
function ajax(){
$.ajaxFileUpload ({ 
url :'storage.php', 
secureuri :false, 
fileElementId :'file', 
dataType : 'text', 
success : function (data){ //$('img').attr('src',data).appendTo($('body'));alert(data);
}, 
error: function (data, status, e){ 
alert(e); 

}) 
}
</script>
<input type="file" name="file" id="file" />
<input type="button"/>
storage.php
<?php 
echo 123;
?>
新手入门,求指导!

解决方案 »

  1.   

    ajaxfileupload 这是个jquery的插件么.
    storage.php 这边不用接收文件么, 需不需要看看php传统的上传文件的写法呢,这边有个栗子.
    http://php.net/manual/en/features.file-upload.post-method.php
      

  2.   

    没打通js到php吗,多半是路径不对
    把xxx.php改成http开头的绝对地址
      

  3.   

    你没有执行 ajax 函数!
    至少需要 <input type="button" onclick=ajax() />