小弟有一个form要同时上传资料与图片并且制作一张缩图
原本没有用AJAX方式很简单,但现在想改用AJAX回传结果
却遇到了一个问题,而我Google也不知道该怎么搜寻,请各位指导一下
看我哪边出了错误
目前PHP回传的错误是找不到 file
我想问题出在我的Javascript最后一行传值部分,请问该怎么改呢
function uploadFile(){
var file = _("file1").files[0];
var bookname = _("bookname").value;
var isbn = _("isbn").value;
var version = _("version").value;
var author = _("author").value;
var translator = _("translator").value;
var press = _("press").value;
var oprice = _("oprice").value; var
nprice = _("nprice").value;
var status = _("sttt").value;
var school = _("school").value;
var language = _("lag").value;
var introduction = _("introduction").value;
var ps = _("ps").value;
var formdata = new FormData();
formdata.append("file1", file);
var ajax = new XMLHttpRequest();
ajax.upload.addEventListener("progress", progressHandler,
false); ajax.addEventListener("load", completeHandler,
false); ajax.addEventListener("error", errorHandler,
false); ajax.addEventListener("abort", abortHandler,
false); ajax.open("POST", "bookupload_query.php");
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
ajax.send(formdata+"&bookname="+bookname+"&isbn="+isbn+"&version="+version+"&author="+author+"&translator="+translator+"&press="+press+"&oprice="+oprice+"&nprice="+nprice+"&status="+status+"&school="+school+"&language="+language+"&introduction="+introduction+"&ps="+ps);
}
另外一问
小弟刚毕业,目前网页都靠自己买书看或是上网查资料
手上的书籍有JavaScript大全,但可能功力还太浅这本书我觉得好难消化
请问有大大觉得哪一本书不错,或是哪个网站不错可以推荐一下吗?
弟一次上PTT发文,排文可能较乱辛苦大家观看了..
:wq