Browsing and uploading a directory using jsp/jsf

Hello to all,
We can browse an upload a file to the server, but how can we browse the directory and upload it?
Thanks in advance.

Remember that at the end of the day, JSP results in an HTML page so you are subject to the same restrictions as a plain ol' HTML page. So the short answer is you can't.
You can create a (signed) java applet and embed that on the page to possibly do what you want.
HTH.

Similar Messages

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • Isolated: WEP is messing up my web browsing and uploads. Why?

    My web browsing and uploads keep "hanging" when accessing my AP Extreme wirelessly.
    A straight HTML downloads fine. But a page that has code that talks back to the server (e.g. a Google docs page) hangs. Also it seems that javascript navigation that sends info back up to the server also hangs.
    I just discovered after resetting my base station, this only happens when I use WEP encryption.
    I don't want to leave my network open. How do I fix this?

    If you search you'll find lots of complaints about this very problem. I'm not sure that a single, specific solution was ever reported.
    I suffered from this problem also. To me it seemed to be related to the fact that I had the "Create closed network" option selected.
    It also seemed that I had to make sure I entered the IP address of my router, but in my case that is because the AEBNs are not providing my DHCP service - my DSL router is.
    There is also an Airport Extreme update out on Apple's web site that may help.
    Whatever the problem(s), in my case turning off "Create closed network" and entering my router's IP address in the AEBN configuration seemed to solve the issue.
    And, by the way, it was Google that I was having a problem with, and Google that everyone else was having a problem with!
    Good luck.

  • Browse and Upload

    Hey guys,
    Im trying to create a browse and upload interface on my website but to no avail. Creating the buttons worked; but making them do what they are suppose to do doesnt. For example, i created a Browse and Upload button. The browse button would search for the file, but the upload button do nothing at all. How do i enable upload to work? Can it be done by html coding? Is it some settings that must be enabled on the server itself?
    Thanks!

    I don't think I quite understand what you are trying to do? You created a browse function, do you mean search function so you can search for something on your website? Also is the upload function so people can upload content to your server?
    To get the upload function to work you will need a lot more than just simple html. Html is not a programming language it is a markup language that just tells the browse what to show. You would need PHP or JS to get an upload function to work with your server.
    I bet there are a ton of tutorials on youtube. Try searching for 'how to create an upload function on my website'.
    This is beyond what Muse can do. I hope I understood what you were asking. If not please give me more details.

  • How can I download Firefox onto a disk from my Windows PC, and then take the disk to my Mac and upload it to use on the Mac? Safari does not work anymore.

    My Mac assures me that I am connected to the internet, using Airport and also ethernet, but Safari never gives me a home page. Can I download Firefox onto a disk using my Windows PC and then take the disk to the Mac and upload Firefox to use on the Mac ?

    You can grab a "full" installer (.dmg file) from this page (scroll down to your preferred language):
    https://www.mozilla.org/firefox/all/

  • Uploading a file using jsp and com.oreilly.servlet lib package

    Sorry to bother you but I need your help folks
    I am developing an application to pick up files from a database and sent to a specified location on a different system.
    I am presently trying to run this code,I have placed this lib package from oreilly which is supposed to encapsulate the usage of file uploads,which is a jar file called cos.jar into C:\Program Files\Java\jdk1.5.0_03\jre\lib\ext folder .I have a jsp page that calls the bean which does the upload and implement the classes in the oreilly package.I am using tomcat 5
    [b]the jsp page that acts as the user interface
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Please Choose The File</title>
    </head>
    <body bgcolor="#ffffff">
    <table border="0"><tr>
    <form action="Upload.jsp" method="post"
    enctype="multipart/form-data">
    <td valign="top"><strong>Please choose your document:</strong><br></td>
    <td> <input type="file" name="file1">
    <br><br>
    </td></tr>
    <tr><td><input type="submit" value="Upload File"></td></tr>
    </form>
    </table>
    </body>
    </html>
    this is the jsp page that calls the bean
    <jsp:useBean id="uploader" class="com.UploadBean" />
    <jsp:setProperty name="uploader" property="dir" value="<%=application.getInitParameter(\"save-dir\")%>" />
    <jsp:setProperty name="uploader" property= "req" value="${pageContext.request}" />
    <html>
    <head><title>file uploads</title></head>
    <body>
    <h2>Here is information about the uploaded files</h2>
    <jsp:getProperty name="uploader" property="uploadedFiles" />
    </body>
    </html>
    [b]this is the bean class
    package com;
    import java.util.Enumeration;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.ServletRequest;
    import com.oreilly.servlet.MultipartRequest;
    import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
    import javax.servlet.*;
    public class UploadBean {
    private String webTempPath;
    private HttpServletRequest req;
    private String dir;
    // private ServletRequest request;
    public UploadBean( ) {}
    public void setDir(String dirName) {
    if (dirName == null || dirName.equals(""))
    throw new IllegalArgumentException("invalid value passed to " + getClass( ).getName( )+".setDir");
    //webTempPath = dirName;
    dir = dirName;
    /* public String getDir()
    return webTempPath;
    public void setReq(ServletRequest request) {
    if (request != null && request instanceof HttpServletRequest)
    req = (HttpServletRequest) request;
    } else {
    throw new IllegalArgumentException("Invalid value passed to " + getClass( ).getName( )+".setReq");
    public String getUploadedFiles( ) throws java.io.IOException{
    //file limit size of 5 MB
    MultipartRequest mpr = new MultipartRequest(req,dir,5 * 1024 * 1024,new DefaultFileRenamePolicy( ));
    Enumeration enume = mpr.getFileNames( );
    StringBuffer buff = new StringBuffer("");
    for (int i = 1; enume.hasMoreElements( );i++){
    buff.append("The name of uploaded file ").append(i).append(" is: ").append(mpr.getFilesystemName((String)enume.nextElement( ))).append("<br><br>");
    }//for
    //return the String
    return buff.toString( );
    } // getUploadedFiles
    On running the code I find this error messages
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: javax/servlet/ServletRequest
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:73)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NoClassDefFoundError: javax/servlet/ServletRequest
         com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
         com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:151)
         com.UploadBean.getUploadedFiles(UploadBean.java:49)
         org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:63)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
    Apache Tomcat/5.5.9
    tanks

    Hi,
    Looks like you are missing a file from the classpath. Make sure servlet.jar is available in your classpath. Ordinarily files in <tomcat_home>/lib directory should be added automatically. You need to check why it hasn't been added in your case. A good place to start would be the bat files in the bin directory viz startup.bat, catalina.bat etc.
    cheers,
    vidyut

  • Browse and upload file - Forms(6i)

    Hi Friends,
    How to enable users to browse and select a file from their local machine in a D2K forms (6i) and upload to the database unix directory
    Thanks
    Ramya

    Hi Friends,
    my exact requirement -
    I have a form with 2 buttons -
    First Button -
    I have to create a external table,the file that is associated with external table is browsed in the form through button,after the file is browsed ,the same file has to be placed in unix directory.
    Second button -
    This button is to execute a packaged procedure which will be using the data from the file associated with the external table that we placed in the unix directory ( which i explained under button1)
    Thanks
    Ramya

  • Upload Entire Directory Using CFFILE

    I need to write an application that will allow the user to
    select all the contents of a directory on their local hard drive
    (or just point to the directory) and upload all the files in that
    directory to a location on a the web server. The user should not
    have to point to a file, just select all the contents at once.
    Does anyone know how to to so this using CFFILE? We are using
    ColdFusion 8.
    Thanks in Advance!!

    > If not, there must be a away--ColdFusion is such a great
    program, and I have
    > gotten it to do just about anything we need it to do
    except upload multiple
    > files files at once to our server...
    The files you are uploading are on the client computer.
    ColdFusion has
    *no* interaction with the client computer at all. All
    communications are
    between client and WEB SERVER. File uploads are handled by
    the client
    computer, using the provisions of the HTTP protocol, which -
    as implemented
    by a web browser - only allows for single files to be
    uploaded, via each
    file input control on a form.
    If you want multiple files to be uploaded from a client
    computer using a
    single control, you need to use something other than a web
    browser (as
    suggested by someone else: some manner of applet, perhaps
    embedded in an
    HTML document).
    The applet will pass the data to the web server, and if the
    request is for
    a mime type that the web server has been configured to pass
    to ColdFusion
    (usually a CFM or a CFC file), then the web server will pass
    the request to
    ColdFusion, which will deal with it however you tell it to.
    The problem isn't getting the files to CF; it's getting them
    to the web
    server in the first place. CF's got nothing to do with your
    problem (or,
    intrinsically, its solution).
    Adam

  • Upload video by using jsp/servlet

    I'm using jsp/servlet to upload video file but I have a problem.
    This error occurs for preparing SQL statement when I cast OraclePreparedStatement.
    It is " Error : weblogic.jdbc.rmi.SerialPreparedStatement
    at jsp_servlet._upload._jspService(_upload.java:185)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
    Please help me asap.
    Thanks

    You need to use the Oracle jdbc driver. Apparently, the Weblogic JDBC driver is being selected:
    weblogic.jdbc.rmi.SerialPreparedStatement
    The Oracle JDBC classes can be found in <ORACLE_HOME>/jdbc/lib/See <ORACLE_HOME>/jdbc/readme.txt for how to specify the correct class path in the application.
    I would have thought that the oracle JDBC driver would have been selected (if in the classpath) or an exception would be raised if the Oracle JDBC driver was not found.... because the code should include:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    This should load the Oracle jdbc driver and classes, not the weblogic ones. IF the Oracle JDBC drivers are not found, an exception should be raised...

  • How can I upload an image using JSP in database(MySQL)

    I have to develop an application in which users can register themselve by filling up thier information(name, address) etc along with their photo.
    Storing nam etc. is simple but i am unable to upload photo using JSP.

    Here are lot of examples: http://www.google.com/search?q=jsp+file+upload
    Or if you actually have implemented something which doesn't work as expected, then please ask specific questions.

  • List file under directory using JSP

    Hi,
    Does anyone have a code to list all files under a certain directory in JSP? Thanks alot!

    thank you so much... l already have a code working, but l can't make it download excle file as it displays them online. l want to force download. thanks
    <%@ page import="java.io.*" %>
    <%@ page import="java.util.*" %>
    <%@ page errorPage="listFiles_error.jsp" %>
    <%
    // To change the directory that is listed, change this variable
    // \ character must be escaped with a second \ as below
    String directoryName = "c:\\Tomcat\\webapps\\examples\\jsp";
    // This variable needs to point to the URL that will be after the
    // domain name for the above directory (needs to be setup in your
    // application server)
    String urlName = "/examples/jsp/";
    // Loads the list of files in the directory
    File directory = new File(directoryName);
    File[] fileList = directory.listFiles();
    Hashtable sortedFiles = new Hashtable(fileList.length);
    // Loops through each file
    for(int i=0; i<fileList.length; i++) {
    File file = fileList;
    // Skip subdirectories
    if(file.isDirectory())
    continue;
    String name = file.getName();
    int dotIndex = name.indexOf('.');
    // Skip files with no extension
    if(dotIndex < 0 || dotIndex+1 >= name.length())
    continue;
    String fileName = name.substring(0,dotIndex);
    String fileType = name.substring(dotIndex+1).toLowerCase();
    // Only process PDF, REP, and XLS file types
    if(!fileType.equals("pdf") && !fileType.equals("rep") && !fileType.equals("xls"))
    continue;
    // Organize like filenames for processing later
    Hashtable fileTypes = (Hashtable)sortedFiles.get(fileName);
    if(fileTypes == null) {
    fileTypes = new Hashtable(10);
    sortedFiles.put(fileName,fileTypes);
    fileTypes.put(fileType,file);
    %>
    <html>
    <head>
    <title>
    listFiles
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
    <!--
    body {
         background-image: url(bkg2.gif);
         margin-left: 0px;
         margin-top: 0px;
         margin-right: 0px;
         margin-bottom: 0px;
    .style2 {font-size: large; color: #000066; }
    .style3 {font-size: medium; color: #000066; }
    -->
    </style></head>
    <body bgcolor="#ffffff">
    <table width="100%" border="0">
    <tr>
    <th background="chead.gif" scope="col"><div align="left"><img src="jpmorgan_logo.gif" width="200" height="40" border="0"></div></th>
    </tr>
    </table>
    <p> </p>
    <TABLE width="700" height="106" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000033">
    <tr>
    <th width="370" height="33"><div align="left" class="style2">Name</div></th>
    <th width="40"><div align="left" class="style2">PDF</div></th>
    <th width="40"><div align="left" class="style2">Rep</div></th>
    <th width="40"><div align="left" class="style2">Excel</div></th>
    </tr>
    <%
    // Loop through each file name, outputting the data in a tabular format.
    Enumeration e = sortedFiles.keys();
    while(e.hasMoreElements()) {
    String fileName = (String)e.nextElement();
    Hashtable fileTypes = (Hashtable)sortedFiles.get(fileName);
    File pdfFile = (File)fileTypes.get("pdf");
    File reportFile = (File)fileTypes.get("rep");
    File excelFile = (File)fileTypes.get("xls");
    %>
    <tr>
    <td height="63" align="left" valign="bottom"><div align="left" class="style3"><%=fileName%></DIV></td>
    <% if(pdfFile != null) {
    // Output the PDF Entry
    %> <td width="40" align="left" valign="bottom"><a href="<%=urlName+pdfFile.getName()%>"><img src="PDF.gif" width="40" height="40" border="0"></a></td>
    <% } else {
    %> <td width="40" align="left" valign="bottom"> </td>
    <% }
    %>
    <% if(reportFile != null) {
    // Output the Report Entry
    %> <td width="40" align="left" valign="bottom"><a href="<%=urlName+reportFile.getName()%>"><img src="Rep.gif" width="40" height="40" border="0"></a></td>
    <% } else {
    %> <td width="1" align="left" valign="bottom"> </td>
    <% }
    %>
    <% if(excelFile != null) {
    // Output the Excel Entry
    %> <td width="40" align="left" valign="bottom"><a href="<%=urlName+excelFile.getName()%>"><img src="xls.Gif" width="40" height="40" border="0"></a></td>
    <% } else {
    %> <td width="1"> </td>
    <% }
    %>
    </tr>
    <%
    %>
    </table>
    </body>
    </html>

  • File upload in oracle9i using JSP page from browser

    Hi guys
    I need to store a pdf file from the JSP page into the Oracle9i DB.
    FrontEnd: Netbeans6.0
    Backend: Oracle9i db server
    I need Jsp code and table creation code i want to create in the Database.
    Pls help me out it is urgent.

    Javamu wrote:
    Hi guys
    I need to store a pdf file from the JSP page into the Oracle9i DB.
    You mean Servlet.
    FrontEnd: Netbeans6.0Netbeans is not a front end to anything. It is an IDE.
    Backend: Oracle9i db server
    I need Jsp code and table creation code i want to create in the Database.This site is not a place to get codes. This site is a place to get help with codes you have written. This site is also not an Oracle or general database or SQL question support forum.
    Pls help me out it is urgent.If it is urgent then you are cooked.
    You can start learning about the various things you need here
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
    http://java.sun.com/docs/books/tutorial/jdbc/index.html

  • Browse and upload a file

    Hi , i'm bulding an application using swing , what i'm having is 2 textfield and 2 buttons . and now what i want is , when i click the button1 i should be able to browse through my machine and should be able to load a file to the application .
    The same way like a notepad will be loading a TXT file , can u please help me .
    Thanks
    Peeths

    reading the file to the text are is not a problem ,
    but the problem comes wen i want to surf through the
    machine and wanna locate the file to get the file
    name .Thus why Camickr was pointing you to the link on JFileChoosers. For
    more (technical) information on this
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JFileChooser.html
    Be sure you you have an understanding of readers (eg
    BufferedReader* and FileReader**) as well as using the File*** classes,
    as you more likely will be using them.
    Reformer!
    *..... http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html
    **... http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileReader.html
    *** . http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

  • Viewing and uploading documents when using a business package in the portal

    DMS works fine in the ECC backend and we are able to create and view documents but when attempting to view a document via the Business Package Maintenance Supervisor or Maintenance Technician, error returns with "No originals available for the document".  we are using Enh Pack 3 but can find no configuration advice in the Business Package technical configuration.  Did a search here but could not find anything specific.  Any help appreciated

    Hi Frank,
    When you upload document into SAP DMS, you need to check-in these for storing into repository. Have you checked-in documents? if not then these documents can;t be retrieved by the system. Kindly check and revert back on this solution.
    Hope this will help.
    Regards,
    Ravindra

  • How to check files in the directory using JSP?.

    Hi,
    How can i check the file is directory or file and readable or writable and file size and type of file(Ex. jpg, txt, doc., etc). i want to list the specific type of file in the particular directroy.. please help me..
    Regards
    CHinna

    With the File class, using the methods isFile(), isDirectory(), canRead(), canWrite(), length() and getName()
    With File.listFiles() you can get a directory listing. If you want to limit the amount of files returned, you can pass your own FileFilter to it.
    http://java.sun.com/javase/6/docs/api/java/io/File.html

Maybe you are looking for

  • How do I find a hard drive connected to Airport Extreme Base Station?

    *Apple Says:* "If your base station supports it, you can connect a USB hard disk to the USB port on your base station and computers on your network (both wired and wireless) can connect to it to access, share, and store files and data." Cool. So I fo

  • [T410] Problem with sound system

    When I press the Mute button on the keyboard (near Esc button), the light on the button is on and the sound is muted correctly. However, when I press it again to allow the sound, it does not. The light on the button if off, but the sound is still mut

  • Yosemite Finder: bug when dragging files in full screen

    I use my Finder in full screen mode. When I drag files through some folders, the entire content of the window moves up so that I cannot see the top files in any column anymore. The only solution to this bug is to end full screen and then start full s

  • IPhoto Library Transfer to Smaller Hard Drive

    Is it possible to only restore parts of an iPhoto library to a new Air from a Time Machine backup? I recently upgraded to a new Air that has a smaller hard drive size and can't handle all of my photos. Is there a way to transfer part of my photo libr

  • Help connecting to Oracle via ADODB in MS Access 2003

    I'm attempting to use vb within Microsoft Access to return a recordset. I can connect, but I when I execute my select statement, I get the following message: Run-time error '-2147217865 (80040e37)': [Microsoft][ODBC driver for Oracle][Oracle]ORA-0094