It is possible to determine the access path for the file in Function

6

I have a 'Java WEB' application where I am using a function that opens the .pdf file I determine, however it only opens .pdf that are in the same folder where my project is saved, I have already tried to change my String variable that calls the .pdf file and put the Access path, for example, " C: \ test.pdf " but it never finds the file if I put the path together, is it possible to change the access path of the files?

<%
        String arquivo = "";
        String i = "";

        try {
            if (request.getParameter("nomeArq").contains("null")){
                arquivo = request.getAttribute("nomeArquivo").toString();
            }else{
                arquivo = request.getParameter("nomeArq");
            }
        } catch (Exception e) {
            arquivo = request.getAttribute("nomeArquivo").toString();
        }
        try {
            i = request.getParameter("numeroPag").toString();
        } catch (Exception a) {
            i = request.getAttribute("pagina").toString();
        }


    %>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><scripttype="text/javascript">
        $(function () {
            window.onload = function abrirPdf() {
                var iframe = $("#LoteSlips");
                iframe.attr("src", '<%=arquivo%>_ERRO.pdf#zoom=200&page=<%=i%>'); 
            };
        });
    </script>
    
asked by anonymous 23.09.2016 / 16:06

1 answer

3

You have stumbled upon a security issue. By default browsers do not allow web applications to access local files without user permission. What's right, imagine you accessing any website, and while you browse the site, it takes several files from your computer. Nothing good is not it?

Alternatively, you can upload the file, process it on the server, and return the result to the client . I do not know if that solves your problem, but that's what can be done.

    
15.12.2016 / 23:59