如何通过Ajax从html文件输入发送文件路径?

时间:2011-03-02 07:24:01

标签: ajax

如何通过Ajax从html文件输入发送文件路径?

1 个答案:

答案 0 :(得分:1)

我试图在Chrome中获取它,但出于安全原因,它可能会返回意外值


//i have an input of file type with name image_file
//<input type=​"file" name=​"image_file"/>​
var path = $('input[type=file][name=image_file]').val();
alert(path);
/*
i got "C:\fakepath\wattan-company-view.gif"
but it is in E:\..., but IE i don't know its behavior especially its earlier versions
*/

我想知道的是你需要什么路径????? 如果你想用ajax iframe post form jquery plugin上传它非常容易使用