是否可以通过JavaScript将文件传递给PHP?(最好使用ajax)。如果我们有以下代码:
<!DOCTYPE html>
<html>
<body>
<input type='file' id='upld' onChange=' f=this.files[0] '>
<input type='button' onClick='ajax_pass()'>
<script>
function ajax_pass()
{
console.log(f);
//Send 'f' using ajax to php imaginary file...
}
</script>
</body>
</html>
我是新手JS编程,无法想象POST或GET如何包含整个图像。你能给我解释一下吗?