1 Replies - 3373 Views - Last Post: 05 March 2012 - 05:32 PM

#1 diamond00811  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 11-December 11

file path in jsp code

Posted 24 February 2012 - 10:57 PM

hi
I have jsp code browse files then get the path of upload file
the problem is the code give only the name of file not a path
<%@ page import="java.lang.Object" %>
        <%@page import=" java.util.Scanner" %>
        <%@ page  import =" java.io.*" %>
        <%@page  import ="java.io.StreamTokenizer" %>
        <%@ page  import=" java.sql.*"%>
        <%@page  import=" java.util.*"%>
        <%@page  import=" java.io.FileReader"%>
        <%@page  import ="javax.swing.*"%>
        <%@page import="javax.servlet.ServletContext" %>
        <%@page import="java.lang.Object" %>
    
<form  action="newjsp.jsp" method="get" enctype="multipart/form-data>
            <div align="left" >      
                <input type="file" name="F1" > <br>
                <input type="submit" name="send">
<%      String s=request.getParameter("F1");

             String r=  request.getRealPath(s)  ; 
             out.print(s);%>


Is This A Good Question/Topic? 0
  • +

Replies To: file path in jsp code

#2 Kiakime  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 24
  • Joined: 27-February 12

Re: file path in jsp code

Posted 05 March 2012 - 05:32 PM

This is a stab in the dark, but maybe you need to change "out.print(s)" to
out.print(r)
? It looks like that's going to print out the file name, not the file path.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1