How to get the path of a file before its uploaded?

后端 未结 3 366
[愿得一人]
[愿得一人] 2020-12-22 10:53

I have an upload box...


相关标签:
3条回答
  • 2020-12-22 11:34

    Sites like Facebook, etc, use signed Java applets for this sort of thing (to enable local file reading), and integrate the image upload into that. Technically, you'd be able to pass data between Java and Javascript to prime it for upload, but the whole thing'd be non-trivial :) Check out http://jumploader.com/ for something which might be of use.


    (source: jumploader.com)

    0 讨论(0)
  • 2020-12-22 11:44

    Recent browsers won't let you get at that type of info. file inputs are more restrictive for security.

    0 讨论(0)
  • 2020-12-22 11:52

    Try this:

    <script>
    function lalala(str){
        alert(str);
    }
    </script>
    
    <form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
    
    <input type="file" name="file" id="file" onchange="lalala(this.value);" />
    </form>
    

    It worked for me in IE8 it gives me the complete path but in firefox and chrome is just prints the file name :(

    0 讨论(0)
提交回复
热议问题