dounianxie2058 2012-07-01 16:10
浏览 333

在jquery中获取fakepath

am trying get size of a file by passing the file bath from javascript to an php file then return the result , problem is javascript passing file bath as the following ex, c:\fakepath\NAME OF THE FILE , so the php file getting an wrong path so always returning an false !!!

 $(document).ready(function (){


        $("#file").click(function (){


            fileBath=$("#name").val();

                $.get('newfile2.php','fileBath='+fileBath,function(data){
                alert(data);

                    });
            });
});

php file

getmax($_GET['fileBath']);

function getmax($fileBath){

    $value=filesize($fileBath);
    echo  $value;

}

as i said the return value FALSE in php file because file bath is wrong !!

  • 写回答

4条回答 默认 最新

  • doukan6564 2012-07-01 16:19
    关注

    use php str_replace or preg_replace .it will replace the unnecessary space or whatever you want then there wont be any problem

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号