如何获取“ajax-sending-filename”在php中


how to get the "ajax-sending-filename" in php

是否有可能获得文件的名称女巫正在发送一个帖子/得到我的php。

或者我必须通过javascript传递文件名?

发送AJAX请求时没有"filename",因为对PHP文件的调用发生在客户端浏览器内部。

By using PHP
<?php 
//you'll get file name
echo $_FILES['field_name']['name'];

?>
<script>
//you will get the full path
alert($('field_id').val());

//获取你的字段值Var value =$('field_id').val();

 //this will identifies your last / in that value 
    var file_name = value.substring(value.lastIndexOf('/')+(value.length-value.lastIndexOf('/')));

</script>