How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax?

后端 未结 11 2598
谎友^
谎友^ 2020-11-21 04:36

How to get full path of file while selecting file using




        
11条回答
  •  悲哀的现实
    2020-11-21 05:27

    Try This:

    It'll give you a temporary path not the accurate path, you can use this script if you want to show selected images as in this jsfiddle example(Try it by selectng images as well as other files):-

    JSFIDDLE

    Here is the code :-

    HTML:-

     
    
    

    JS:-

    $('#i_file').change( function(event) {
        var tmppath = URL.createObjectURL(event.target.files[0]);
        $("img").fadeIn("fast").attr('src',URL.createObjectURL(event.target.files[0]));
    
        $("#disp_tmp_path").html("Temporary Path(Copy it and try pasting it in browser address bar) --> ["+tmppath+"]");
    });
    

    Its not exactly what you were looking for, but may be it can help you somewhere.

提交回复
热议问题