Switch to full style
What's behind JSP & Servlets
Post a reply

getting file name of html input file tag using jsp

Mon Dec 07, 2009 10:19 am

Hi, everybody.
i want to get file name from html file input form using jsp.

my codes are followed as:

Code:
    <table>
        <tr>
            <td >
             <input type="file" id="csvfilebrowse" name="csvfilebrowse" style="width:400px; height:20px" onChange="getfilename();">
             
         <script type="text/javascript">
            // <![CDATA[
           
            function getfilename() {
                var v_csvfileName = '';
                [b]v_csvfileName[/b] += document.getElementById('csvfilebrowse').value;
            };
         // ]]>
            </script>
          </td>
           
        </tr>
        <tr>
            <td align="left">
            <%   
               Workbook workbook = null;
               Sheet sheet = null;
               String csvFileName = [b]v_csvfileName;[/b]
               // Reading Test
               //Workbook workbook = Workbook.getWorkbook(new File(file_path+"/reportToExcel.xls"));
               workbook = Workbook.getWorkbook(new File(csvFileName));
               sheet = workbook.getSheet(0);
               for(int i=0;i<sheet.getColumns();i++){
                  Cell a1 = sheet.getCell(i,0);
                  String stringa1 = a1.getContents();
               }
                 %>
            </td>
        </tr>
    </table>



here, what i want to get, how to convert the filename variable named v_csvfileName of javascript to the filename named csvFileName of jsp.

please kindly help me.
thank you.



Post a reply
  Related Posts  to : getting file name of html input file tag using jsp
 Google Chrome input file     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 PHP HTML form with to file upload     -  
 read php file in asp and display it as html     -  
 insert information in html file with java     -  
 Copy file to file in java code- implementation     -  
 file descriptor vs file pointer     -  
 How to convert xml file to Pdf file using C     -  
 web.xml file     -  
 C++ File I/O     -