因为不能上传图片到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;
?>
新手入门,求指导!
storage.php 这边不用接收文件么, 需不需要看看php传统的上传文件的写法呢,这边有个栗子.
http://php.net/manual/en/features.file-upload.post-method.php
把xxx.php改成http开头的绝对地址
至少需要 <input type="button" onclick=ajax() />