【发布时间】:2012-04-21 16:30:11
【问题描述】:
我希望在用户使用 $.ajax 在输入文件中选择文件时异步上传文件。但是接收调用的php返回索引未定义。 jquery代码如下:
$("#urlimatge").change(function(){
var filename = $("#urlimatge").val();
$.ajax({
type: "POST",
url: "utils/uploadtempimg.php",
enctype: 'multipart/form-data',
data: {'urlimatge' : filename },
success: function(response){
alert(response);
}
});
});
以及调用调用的 php:
$image = new gestorimatges();
$target_path = $image->uploadTemp($_FILES['urlimatge']['name'],$_FILES['urlimatge']['tmp_name']);
谢谢
【问题讨论】: