Finally upload/download BLOB solution in JSP??

Hello there, greetings to forum,
I am working on JSPs and Oracle 9i with Tomcat 4.1.29. Suppose we have the very simple example of a user who registers through an HTML form by entering his name, surname and his picture via the "Browse" field (input type="file" etc). Everything so far so good for now until the next page waits for the parameters.
My main problem is how to tell my server (tomcat) that the remote user browsed his file from e.g. c:\docs\pics\vacation\ ??? As far as i can remember the JSP code is server sided so i can't tell tomcat that the file is in c:\docs\pics\vation\ . And finally: how do i grab the picture for the user's dir? The rest i know, how to put it in the BLOB column and so on. And also, is there any way of checking if the user uploads a photo or anything else except than examining the extension?
Thanx in advance, be well.
PS. Don't post servlet-like code, i am 100% on JSPs unless you suggest a Java Stored Procedure.

Hello there, greetings to forum,
I am working on JSPs and Oracle 9i with Tomcat 4.1.29. Suppose we have the very simple example of a user who registers through an HTML form by entering his name, surname and his picture via the "Browse" field (input type="file" etc). Everything so far so good for now until the next page waits for the parameters.
My main problem is how to tell my server (tomcat) that the remote user browsed his file from e.g. c:\docs\pics\vacation\ ??? As far as i can remember the JSP code is server sided so i can't tell tomcat that the file is in c:\docs\pics\vation\ . And finally: how do i grab the picture for the user's dir? The rest i know, how to put it in the BLOB column and so on. And also, is there any way of checking if the user uploads a photo or anything else except than examining the extension?
Thanx in advance, be well.
PS. Don't post servlet-like code, i am 100% on JSPs unless you suggest a Java Stored Procedure.

Similar Messages

  • A final solution for upload/download BLOB on JSP?

    Hello there, greetings to forum,
    I am working on JSPs and Oracle 9i with Tomcat 4.1.29. Suppose we have the very simple example of a user who registers through an HTML form by entering his name, surname and his picture via the "Browse" field (input type="file" etc). Everything so far so good for now until the next page waits for the parameters.
    My main problem is how to tell my server (tomcat) that the remote user browsed his file from e.g. c:\docs\pics\vacation\ ??? As far as i can remember the JSP code is server sided so i can't tell tomcat that the file is in c:\docs\pics\vation\ . And finally: how do i grab the picture for the user's dir? The rest i know, how to put it in the BLOB column and so on. And also, is there any way of checking if the user uploads a photo or anything else except than examining the extension?
    Thanx in advance, be well all.

    Can you do me the favor of sending the new SYMCJIT.DLL file, I
    need it badly, I have a test coming up and I still havent been
    able to install Oracle Personal on my computer. Also do you know
    if I need to install the Form Builder first and then Personal
    Oracle? But before I forget I dont have a P4, so if this file
    doesnt associate to the issue that I cant install on Win XP,
    then you can disregard this note.
    Thank You,
    New user & loving it.
    Dear all,
    I have a new SYMCJIT.DLL file that can solve this problem. This
    is only a 26.4 K file. If any body require this please send me a
    mail.
    I there anybody who could install D2K 6i rel 2 on P4 with
    windows XP?
    Take care,
    [email protected]

  • [Solved]How to upload / download BLOB images ADF - JSF

    Hi everyone. I am a newbe ADF - JSF developer and I need to do a web app. in which I have to upload jpeg images to a table (in an oracle 8 DB) that has a BLOB column, also I need to be able to download images from the same table and show them in the web app. I have seen the examples on how to do this using the intermedia data types but I can't use this because the table already has a lot of records in it and the DB admin won't move a finger to migrate the data because other apps. are using the table.
    I have been looking on the internet but haven't been able to find something that describes this process.
    Thanks.

    Hello Kuba, I am trying to execute your app but I get the following error when I try to run it:
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
         Missing class: oracle.adf.view.faces.webapp.AdfFacesFilterHelper
         Dependent class: oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl
         Loader: current-workspace-app.web.ADFUploadAndDownloadFiles-ViewController-webapp:0.0.0
         Code-Source: /root/jdevhome/mywork/ADFUploadAndDownloadFiles/ViewController/public_html/WEB-INF/lib/adf-faces-impl.jar
         Configuration: WEB-INF/lib/ directory in /root/jdevhome/mywork/ADFUploadAndDownloadFiles/ViewController/public_html/WEB-INF/lib
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2051) [usr/local/jdevstudio1013/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@27634497]
         at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1665) [usr/local/jdevstudio1013/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@27634497]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1621) [usr/local/jdevstudio1013/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@27634497]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1606) [usr/local/jdevstudio1013/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@27634497]
         at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap]
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.<init> (AdfFacesFilterImpl.java:341) [root/jdevhome/mywork/ADFUploadAndDownloadFiles/ViewController/public_html/WEB-INF/lib/adf-faces-impl.jar (from WEB-INF/lib/ directory in /root/jdevhome/mywork/ADFUploadAndDownloadFiles/ViewController/public_html/WEB-INF/lib), by current-workspace-app.web.ADFUploadAndDownloadFiles-ViewController-webapp:0.0.0]
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native method) [unknown, by unknown]
         at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) [unknown, by unknown]
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) [unknown, by unknown]
         at java.lang.reflect.Constructor.newInstance (Constructor.java:494) [unknown, by unknown]
         at java.lang.Class.newInstance0 (Class.java:350) [jre bootstrap, by jre.bootstrap]
         at java.lang.Class.newInstance (Class.java:303) [jre bootstrap, by jre.bootstrap]
         at oracle.adf.view.faces.webapp.AdfFacesFilter.init (AdfFacesFilter.java:48) [jre bootstrap, by jre.bootstrap]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.getFilterConfig (HttpApplication.java:7523) [jre bootstrap, by jre.bootstrap]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke (ServletRequestDispatcher.java:548) [jre bootstrap, by jre.bootstrap]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal (ServletRequestDispatcher.java:376) [usr/local/jdevstudio1013/jlib/adf-faces-api.jar (from <classpath> in /root/jdevhome/mywork/ADFUploadAndDownloadFiles/ViewController/public_html), by current-workspace-app.web.ADFUploadAndDownloadFiles-ViewController-webapp:0.0.0]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest (HttpRequestHandler.java:870) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest (HttpRequestHandler.java:451) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest (HttpRequestHandler.java:218) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:119) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:112) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run (ServerSocketReadHandler.java:260) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket (ServerSocketAcceptHandler.java:230) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800 (ServerSocketAcceptHandler.java:33) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run (ServerSocketAcceptHandler.java:831) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run (ReleasableResourcePooledExecutor.java:298) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
         at java.lang.Thread.run (Thread.java:595) [usr/local/jdevstudio1013/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in /usr/local/jdevstudio1013/j2ee/home/oc4j.jar), by oc4j:10.1.3]
    I'm sure this is trivial for for you, but I can't figure it what to do.... can you help a little here please?
    Thanks.

  • File upload, download using ADF UIX and not JSP

    I have examples for the file upload, download using JSP
    But I want to use ADF UIX. Look and feel in this is impressing and I want to use this. Any one have example for this.
    Users will select a file from their desktop
    This will be stored into the database (Any document. Word, Excel)
    When they query the records then the UIX column need to give a hyperlink. Clicking on the link should prompt to download the file to the local system

    Sure, I use the Apache Commons File Upload package, so that is what I will discuss here ( [Commons File Upload|http://commons.apache.org/fileupload/] ).
    The Commons File Upload uses instances of ProgressListener to receive upload progress status. So first create a simple class that implements ProgressListener:
    public class ProgressListenerImpl implements ProgressListener {
        private int percent = 0;
        public int getPercentComplete() {
            return percent;
        public void update(long pBytesRead, long pContentLength, int pItems) {
            if (pContentLength > -1) { //content length is known;
                percent = (new Long((pBytesRead / pContentLength) * 100)).intValue();
    }So in your Servlet that handles file upload you will need to create an instance of this ProgressListenerImpl, register it as a listener and store it in the session:
    ServletFileUpload upload = new ServletFileUpload();
    ProgressListenerImpl listener = new ProgressListenerImpl();
    upload.setProgressListener(listener);
    request.getSession().setAttribute("ProgressListener", listener);
    ...Now create another servlet that will retrieve the ProgressListenerImpl, get the percent complete and write it back (how you actually write it back is up to you, could be text, an XML file, a JSON object, up to you):
    ProgressListenerImpl listener = (ProgressListenerImpl) request.getSession().getAttribute("ProgressListener");
    response.getWriter().println("" + listener.getPercentComplete());
    ...Then your XMLHttpRequest object will call this second servlet and read the string returned as the percent complete.
    HTH

  • How to upload/download to blob using ADF-toplink?

    I am using ADF-toplink,i tried upload to blob using some of the code given in the ADFBC upload/download application...IT WORKED... but download is not working...I want to know some better method for both uploading and downloading... IN ADF-TOPLINK only......

    Hi guys,
    I'm able to download file in ADF using af:fileDownloadActionListener.......
    does any one knows how to upload a file using ADF???

  • Downloading BLOB from a table.

    Hello,
    First I want to say thatnks for such a great tool like HTMLDB.
    Question is:
    How do I download BLOB from a table. What I am trying to do is. I am uploading files to a default HTMLDB location (wwv_flow_file_objects$) and moving the records to different table (delete file from wwv_file_objects$). Then I would like to be able to download that blobs from a DB by following some link. And I need it to be secure, user have to authenticate to do it. I got to the point where I created process (before header) to download the file. But I am having hard time passing some variables to that process in URL. Can some one advice me on the best practice of doing it. And also if it is a right thing to use before header process to put my own header and start uploading blob in html db. The main reason I do not whant to use DAD for that is simple security issue and ability of storing of the BLOBs only in one table. I prefer to upload it to a temporary location and then move it to other table(s). Then I need to be able to retriev the files back from those tables without moving them around.
    Any help is greatly appriciated

    i think i see what you're asking, but i'll step through the pieces just to make sure i cover your issue:
    it sounds as if you have a procedure that successfully calls wpg_docload.download_file to get your blob out of your images table. for this explanation, lets just say your images table has the same table structure as wwv_flow_files created with something like...
    create table myfiles as select * from wwv_flow_files where rownum < 3;
    ....and let's say your download proc that passed the blob from your myfiles table to wpg_docload.download_file looked something like...
    create or replace procedure getmyfile(
    p_id in varchar2,
    p_mime_type in varchar2 default null)
    as
    l_lob blob;
    l_mimetype varchar2(48);
    l_mime_charset varchar2(255);
    l_filename varchar2(400);
    begin
    select mime_type, blob_content, filename, file_charset
    into l_mimetype, l_lob, l_filename, l_mime_charset
    from myfiles
    where id = p_id;
    if l_mime_charset is not null then
    owa_util.mime_header( l_mimetype, FALSE, l_mime_charset );
    else
    owa_util.mime_header( l_mimetype, FALSE );
    end if;
    htp.p('Content-length: ' || dbms_lob.getlength( l_lob ));
    htp.p('Content-Disposition: attachment; filename="' ||
    wwv_flow_utilities.escape_url( p_url => l_filename, p_url_charset => 'utf-8') || '"');
    owa_util.http_header_close;
    wpg_docload.download_file( l_lob );
    end;
    ...then it sounds as if this is where you start running into issues. to be able to call this procedure from the url, you'd have to grant execute on your getmyfile proc to the db user that your modplsql DAD uses to access your db. once that user was given access to run getmyfile, you could access your files in myfiles by calling a URL like...
    http://myserver.com/pls/mydad/myschema.getmyfile?p_id=1005529367869246
    ...where p_id is the unique id associated with your blob in getmyfiles (you could, of course, use whatever method you want to uniquely identify that file and adjust your select-into statement w/in your getmyfile procedure). so that's all fine and dandy, but it sounds as if you want users to have to authenticate into your html db application before they can access a blob in your images table. it also sounds as if you're on the right track to do so by putting your procedure call in a before_header html db process. you could quite easily call your getmyfile procedure in such an html db pl/sql before_header process with something like...
    begin
    getmyfile (p_id => 1008411584930314);
    end;
    ...which would cause your page to just show the blob associated with the id you passed to getmyfile. because you're now accessing your blob table through html db parsing as your application schema owner, you'd no longer need to grant execute on getmyfile to your modplsql DAD's db user. that eliminates most of the security hole to which you were referring. now that you're calling getmyfile from w/in an html db process, you can take advantage of all the other html db perks such as applying conditions and an authorization scheme to the html db process to really lock things down. finally, you asked about firing your process before_header versus other firing points. before_header is a good way to go, but if you really wanted to execute other procedural logic on your page before showing the blob (and you didn't want to implement that code as before_header processes that fire sequentially before your getmyfile call),you could just throw an htp.init in right before your getmyfile call to clear out your http buffer like so...
    begin
    htp.init;
    getmyfile (p_id => 1008411584930314);
    end;
    ...hope this helps,
    raj

  • Upload Download How To

    I have followed the Upload and Download Files in an Application How To.
    I can upload files into the application but I cannot download.
    When I click on the download link, the full URL appears in the address bar at the top of the screen, but the file does not open.
    Any ideas
    Gus

    Hi Gus,
    I had the same issues after following the upload/download document, and finally after much hunting around i followed the following:
    - You need to create the following function in the schema FLOWS_020100,
    - the function has to be written in upper case
    - and prefixed with the schema the procedure runs in (for example, when you use the function in the schema HR, please change accordingly):
    log as system
    alter session set current_schema=FLOWS_020100;
    create or replace function FLOWS_020100.wwv_flow_epg_include_mod_local(procedure_name in varchar2)return boolean
    is
    begin
    if upper(procedure_name) in ('YOUR_SCHEMA.PROCEDURE_NAME') then
    return TRUE;
    else
    return FALSE;
    end if;
    end wwv_flow_epg_include_mod_local;
    for more information on this function, follow:
    ref: showing blob content (mime type image/jpeg) in reports cloumn
    http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
    So, the mistake i was making was creating the function without putting FLOWS_020100 before wwv_flow_epg_include_mod_local, meaning that the function was created in the schema that i found myself in when creating (System account), and not in FLOWS_020100
    It's quite late, but i hope this helps
    jed
    if you can think of a good synonym for "following", please advise...

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • I would like to upload a excel file using jsp

    Hi,
    I would like to upload the excel file using jsp in my netbeans ide. Please help.
    I don Know what is the error in this jsp file. It is not showing any thing and the file is also not getting uploaded.
    Please gothru the code below.
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ page import="java.io.*" errorPage="err.jsp"%>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="<html:rewrite page="/design.css" />" rel="stylesheet" type="text/css">
    <title>Upload Page</title>
    </head>
    <body onKeyDown="DisablingBackFunctionality()" onLoad="DisablingBackFunctionality()">
    <html:form action="download" >
    <div style="position:absolute; left:100;top:200;">Select an excel File :<input type="file" name="uploadfile"></div>
    <div style="position:absolute; left:190;top:250;"><input type="submit" name="Submit" value="Read"></div>
    <div style="position:absolute; left:336;top:250;"><input type="reset" name="Reset" value="Clear"></div>
    mainmenu
    </html:form>
    </body>
    </html>
    <%
    String contentType = request.getContentType();
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
    DataInputStream in = new DataInputStream(request.getInputStream());
    int formDataLength = request.getContentLength();
    byte dataBytes[] = new byte[formDataLength];
    int byteRead = 0;
    int totalBytesRead = 0;
    while (totalBytesRead < formDataLength) {
    byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
    totalBytesRead += byteRead;
    String file = new String(dataBytes);
    //out.println("<br> file :"+file);
    String saveFile = file.substring(file.indexOf("filename=\"") + 10);
    //out.println("<br> savefile :"+saveFile);
    saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
    //out.println("<br> now file1 :"+saveFile);
    saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1, saveFile.indexOf("\""));
    //out.println("<br> now file2 :"+saveFile);
    //out.print(dataBytes);
    String ext = "";
    if (saveFile.indexOf(".") != -1) {
    ext = saveFile.substring(saveFile.lastIndexOf("."));
    int lastIndex = contentType.lastIndexOf("=");
    //out.println("<br>lst index of"+lastIndex);
    String boundary = contentType.substring(lastIndex + 1, contentType.length());
    //out.println("<br> boundary"+boundary);
    //out.println("<br> file :"+file);
    int pos;
    pos = file.indexOf("filename=\"");
    //out.println("<br> now 0 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 1 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 2 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 3"+pos);
    int boundaryLocation = file.indexOf(boundary, pos) - 4;
    int startPos = ((file.substring(0, pos)).getBytes()).length;
    int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
    FileOutputStream fileOut = new FileOutputStream("D:\\" + saveFile);
    //FileOutputStream fileOut = new FileOutputStream(saveFile);
    //fileOut.write(dataBytes);
    fileOut.write(dataBytes, startPos, (endPos - startPos));
    fileOut.flush();
    fileOut.close();
    session.setAttribute("fil", saveFile);
    //out.println("File saved as " +saveFile);
    %>
    <script type="text/javascript" >
    function DisablingBackFunctionality()
    var URL;
    var i ;
    var QryStrValue;
    URL=window.location.href ;
    i=URL.indexOf("?");
    QryStrValue=URL.substring(i+1);
    if (QryStrValue!='X')
    window.location=URL + "?X";
    </script>
    Please let me know the result as soon as possible. Its my very urgent.
    Thanking Yu,
    Muthu Kumar.R

    No.
    Mylenium

  • Upload/Download file to/from a document library in a SharePoint online site

    Hi,
    I am referring to the below blog for Upload/Download file to/from a document library in a SharePoint online site.
    http://blogs.msdn.com/b/rohitpuri/archive/2007/04/10/upload-download-file-to-from-wss-document-library-using-dav.aspx?CommentPosted=true#commentmessage
    I would like to know if this is feasible with a SharePoint online site.
    If feasible, how can I resolve the below exception I am getting while using the code.
    “The remote server returned an error: (403) Forbidden”.
    Thanks,
    Thanan

    Hi,
    Actually what I am trying to achieve is the two things.
    1) By using only the user's name, need to upload/download from/to the document library of SharePoint online site using the CSOM. (i.e., achieving Single Sign On / Windows Authentication)
    2) I need to achieve the above only by passing the document URL; not by hardcording/ configuring the document library name in the windows application.
    Can anyone pls help on this now?
    [Below code is working fine. But need to arrive the solution whereas the above 2 conditions are not violated.
    using (var clientContext
    = new ClientContext("https://yoursiteurl.com"))
               string passWd
    = "password";
               SecureString securePassWd
    = new SecureString();
               foreach
    (var c in passWd.ToCharArray())
                    securePassWd.AppendChar(c);
                clientContext.Credentials
    = new SharePointOnlineCredentials("username", securePassWd);
               using
    (var fs =
    new FileStream("fileName",
    FileMode.Open))
    var fi =
    new FileInfo("fileName");
    var list = clientContext.Web.Lists.GetByTitle("Doc Library");
                   clientContext.Load(list.RootFolder);
                   clientContext.ExecuteQuery();
    var fileUrl = String.Format("{0}/{1}", list.RootFolder.ServerRelativeUrl,
    fi.Name);
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, fileUrl,
    fs, true);
    Thanks,
    Thanann

  • File Upload/Download

    Hi
    When using the file upload/download functionality, APEX stores the uploaded object in a table by default. See: http://download-uk.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CJAHDJDA
    Is there a way to specify that the file should NOT be stored in a table, but rather, be stored on the file system?. Example in a directory object location.
    I intend to use the upload/download functionality to load csv files that will then be parsed as external tables.
    Thanks
    Kezie

    Hi,
    I modified the above procedure to point to my tables and trying to create the procedure in Apex database and am getting the following error:
    Procedure:
    CREATE OR REPLACE PROCEDURE write_blob_to_file
    ( p_docid IN NUMBER,
    p_directory IN VARCHAR2,
    p_filename IN VARCHAR2 DEFAULT NULL )
    IS
    l_file utl_file.file_type;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER := 32767;
    l_position INTEGER := 1;
    l_blob BLOB;
    l_length INTEGER;
    l_filename VARCHAR2(400);
    BEGIN
    SELECT BLOB_CONTENT, MPP_name
    INTO l_blob, l_filename
    FROM MPP_FILES
    WHERE id = p_docid;
    IF p_filename IS NOT NULL THEN
    l_filename := p_filename;
    END IF;
    l_length := dbms_lob.getlength( l_blob );
    l_file := utl_file.fopen( p_directory, l_filename, 'wb', 32767 );
    WHILE l_position < l_length LOOP
    dbms_lob.read( l_blob, l_amount, l_position, l_buffer );
    utl_file.put_raw( l_file, l_buffer, TRUE );
    l_position := l_position + l_amount;
    END LOOP;
    utl_file.fclose( l_file );
    EXCEPTION
    WHEN others THEN
    IF utl_file.is_open( l_file ) THEN
    utl_file.fclose( l_file );
    END IF;
    raise_application_error( -20001, SQLERRM );
    END write_blob_to_file;
    Error:
    ERROR at line 6: PLS-00201: identifier 'UTL_FILE' must be declared
    4. p_filename IN VARCHAR2 DEFAULT NULL )
    5. IS
    6. l_file utl_file.file_type;
    7. l_buffer RAW(32767);
    8. l_amount BINARY_INTEGER := 32767;
    Please let me know what am i missing. I am pretty new to PL/SQL and Apex.
    Also wondering is there a way to download files from tables using Java Stored Procedure. Please give some pointers.
    Ramesh K

  • Upload / Download document to KM Content Server from WebDynpro Application

    I have a requirement where I need to upload / download document into / from KM Content Server from my WebDynpro Application.
    Is it technically possible and if Yes, can I get any Sample code for this.

    Hi Tahzeeb,
    first of all i would point you to the JavaDocs for KMC API.
    https://media.sdn.sap.com/javadocs/NW04/SPS15/km/index.html
    And here is a small example of reading and storing KM resources.
    For reading:
         * Returns a resource as an InputStream from the KM repository
         * at the given path. The IUser is needed for authorization.
         * @param user      IUser for checking authorisation.
         * @param resPath   Path to the KM resource.
         * @return          Requested resource as a stream.
        private InputStream getKmResource(final IUser user, final String resPath)
            throws ResourceAccessException {
            try {
                final IResourceFactory factory = ResourceFactory.getInstance();
                final RID rid = RID.getRID(resPath);
                final IResource kmResource =
                    factory.getResource(
                        rid,
                        new ResourceContext(getDeprecatedIUser(user)));
                if (kmResource == null) {
                    throw new ResourceNotFoundException(
                        "KM resource not found: " + resPath,
                        resPath);
                return kmResource.getContent().getInputStream();
            catch (WcmException e) {
                throw new ResourceAccessException("Error accessing KM resource: " + resPath, e, resPath);
    And for writing:
         * Stores a resource in the KM repository at the given path with the given name and mimetype.
         * Content is taken from the given inputstream.
         * @param user          IUser for checking authorisation.
         * @param resName   Name of the resource
         * @param resPath     Path to the resource
         * @param mimeType MimeType of the resource
         * @param inputStream  Resource content
         * @throws ResourceAccessException
        private void putKmResource(
            final IUser user,
            final String resName,
            final String resPath,
            final String mimeType,
            final InputStream inputStream)
            throws ResourceAccessException {
            try {
                final ResourceContext rContext = new ResourceContext(getDeprecatedIUser(user));
                final RID rid = RID.getRID(resPath);
                final ICollection kmCollection =
                    (ICollection) ResourceFactory.getInstance().getResource(rid, rContext);
                if (kmCollection == null) {
                    throw new ResourceNotFoundException(
                        "KM resource not found: " + resPath,
                        resPath);
                else {
                    IContent kmContent = new Content(inputStream, mimeType, -1);
                    IResource kmResource = kmCollection.createResource(resName, null, kmContent);
            catch (ResourceException e) {
                throw new ResourceAccessException("Error accessing KM resource: " + resPath, e, resPath);
            finally {
                try {
                    inputStream.close();
                catch (IOException e1) {
                    throw new ResourceAccessException("Error closing InputStream when accessing " + resPath, e1, resPath);
    Hope that helps for a start.
    Best regards,
      ok

  • What file size is used for "optimized" upload/download?

    When I upload my photo files from Aperture (and previously from iPhoto) I routinely use the upload setting named "dowloading of optimized" files.  I know that this downsizes the files for faster upload/download, but still gives a file size acceptable for great onscreen presentation and for a resulting small print of someone downloads.  Can anyone tell what downsizing Aperture/iPhoto does in this case?  For example, 50% jpeg, email sized jpeg, etc.  Since Apple will kill the MobileMe galleries in June I have to switch to another photo presentation host.  For upload to such a host Aperture/iPhoto gives choices like 100% jpeg, 50% jpeg, etc.  What I want to do is end up with something similar to what I now get with the "optimized" setting.  Thank you.

    You will note that I referenced both programs (iPhoto & Aperture) in my original message above, and I have posted in both forums.  Since both programs offer the same (at least on the surface) option of "optimized" to MobileMe galleries, one might assume that both use the same or a similar system.  Lengthly testing of my own is the "best" solution only if I can not find anyone who is knowledgeable about what these programs do in the upload.  It has been my sincere joy over many many years that I often find people on these forums who possess knowledge much greater than I.  As to the programs changing the algorithum at any time, I doubt that since this MobileMe function will disappear in June.  Seems like a strange time to make changes. 

  • How to upload a image file using JSP

    hello to all.
    i am in the learning stage please help me to upload a image file
    using jsp. give the explanation to the code also if possible.
    thanks in advance
    sincerely
    Chezhian

    You may find the following articles useful for the JSP/Servlet part:
    Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
    Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html

  • Upload to BLOB

    How can you do an upload into a blob using ADF/JSP/Struts? I've seen the demo for OrdDoc but would rather have the blob as it would be easier to move between instances over a db link (cannot do with object type).
    Thoughts/tips/code?
    I can provide what does NOT work...

    Here is the code I am using (Error message first):
    Target URL -- http://10.141.146.47:8988/UploadedFiles-ViewController-context-root/uploadDocument.do
    06/12/19 07:49:45 Oracle Application Server Containers for J2EE 10g (10.1.2.0.2) initialized
    Dec 19, 2006 7:49:45 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 19, 2006 7:49:45 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
    Dec 19, 2006 7:49:45 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='uploadedfiles.view.ApplicationResources', returnNull=true
    06/12/19 07:49:48 *** UploadDocumentAction.findForward() ***
    Dec 19, 2006 7:49:48 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 19, 2006 7:49:48 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 19, 2006 7:49:48 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    Dec 19, 2006 7:49:48 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    Dec 19, 2006 7:49:48 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    06/12/19 07:49:55 *** UploadDummyBlobAction.onUpload - START ***
    06/12/19 07:49:55 myrow.getId() = null
    06/12/19 07:49:56 myrow.getFilename() = null
    06/12/19 07:49:56 java.lang.NullPointerException
    06/12/19 07:49:56 at uploadedfiles.view.UploadDocumentAction.onUpload(UploadDocumentAction.java:82)
    06/12/19 07:49:56 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/12/19 07:49:56 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/12/19 07:49:56 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/12/19 07:49:56 at java.lang.reflect.Method.invoke(Method.java:324)
    06/12/19 07:49:56 at oracle.adf.controller.lifecycle.PageLifecycle.handleEvent(PageLifecycle.java:544)
    06/12/19 07:49:56 at oracle.adf.controller.struts.actions.StrutsPageLifecycle.handleEvent(StrutsPageLifecycle.java:252)
    06/12/19 07:49:56 at oracle.adf.controller.lifecycle.PageLifecycle.processComponentEvents(PageLifecycle.java:477)
    06/12/19 07:49:56 at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:235)
    06/12/19 07:49:56 at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:430)
    06/12/19 07:49:56 at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:126)
    06/12/19 07:49:56 at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:222)
    06/12/19 07:49:56 at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:153)
    06/12/19 07:49:56 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    06/12/19 07:49:56 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    06/12/19 07:49:56 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    06/12/19 07:49:56 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    06/12/19 07:49:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    06/12/19 07:49:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    06/12/19 07:49:56 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    06/12/19 07:49:56 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    06/12/19 07:49:56 at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    06/12/19 07:49:56 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
    06/12/19 07:49:56 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
    06/12/19 07:49:56 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    06/12/19 07:49:56 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    06/12/19 07:49:56 *** UploadDocumentAction.findForward() ***
    06/12/19 07:49:56 UploadDocumentAction.findForward()- event : Upload
    06/12/19 07:49:56 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    06/12/19 07:49:56 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    06/12/19 07:49:56 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    06/12/19 07:49:56 at java.lang.Thread.run(Thread.java:534)
    public class UploadDocumentAction extends DataForwardAction {
    protected void processUpdateModel(DataActionContext actionContext) {
    super.processUpdateModel(actionContext);
    // Create a blank record in the model and set it as the current row
    BindingContext bc = actionContext.getBindingContext();
    DCDataControl dc = bc.findDataControl("UploadedFilesServiceDataControl");
    UploadedFilesService service = (UploadedFilesService)dc.getDataProvider();
    service.insertRowIntoUploadedFilesView();
    * public void onUpload( DataActionContext ctx )
    * This handles uploading a file into a blob domain by use of a
    * transient view attribute (TempOrdDoc) and then getting the uploaded
    * file (which is passivated to the oc4j's ordpas folder) and then placing
    * this via input/output stream calls into a BlobDomain to place into the
    * view object's row.
    * Processing Steps:
    * 1. Get access to the current row of the iterator and cast it to an
    * exposed client interface. This allows easier placement of the
    * values into the record.
    * 2. Get access to the TempOrdDoc and retrieve the file source content.
    * this appears to contain the ORD IM passivated blob,ie:
    * C:\jdev1012\jdev\system10.1.2.0.0.1811\oc4j-config\ordpas\ord10858pas
    * 3. Create input stream to this object and output stream to the view
    * object's blob, then read/write the data.
    * 4. Set the view object columns: Content Type, Size, and Blob. Note that
    * we have to get the description from the request to set it.
    * 5. Get access to the application module, then commit the transaction.
    * @param ctx
    public void onUpload( DataActionContext ctx ) {
    System.out.println("*** UploadDocumentAction.onUpload - START ***");
    HttpServletRequest request = ctx.getHttpServletRequest();
    try {
    DCBindingContainer bc = ctx.getBindingContainer();
    DCIteratorBinding iter = bc.findIteratorBinding("UploadedFilesView1Iterator");
    Row r = iter.getCurrentRow();
    UploadedFilesViewRowClient myrow = (UploadedFilesViewRowClient) r;
    System.out.println("myrow.getId() = " + myrow.getId());
    System.out.println("myrow.getFilename() = " + myrow.getFilename());
    OrdDocDomain doc = myrow.getTempOrdDocDomain();
    OrdContentSource ocontent = doc.getContentSource();
    OrdFileSource fSource = (OrdFileSource) ocontent;
    System.out.println( "fSource.getContentLength()=" + fSource.getContentLength());
    System.out.println( "fSource.getFileName()=" + fSource.getFileName() );
    System.out.println( "fSource.getMimeType()=" + fSource.getMimeType() );
    InputStream istream = fSource.getInputStream();
    BlobDomain blob = myrow.getContent();
    int bufsize;
    if ( blob == null ) {
    blob = new BlobDomain();
    bufsize = 32767;
    } else {
    bufsize = blob.getBufferSize();
    r.lock(); // required for a blob update.
    OutputStream out = blob.getBinaryOutputStream();
    int length = 0;
    byte buf[] = new byte[bufsize];
    while ((istream != null) && ((length = istream.read(buf)) != -1)) {
    out.write(buf, 0, length);
    System.out.println("read " + length + " bytes from in, writing to out");
    istream.close();
    out.flush();
    out.close();
    myrow.setContent( blob );
    BindingContext bctx = ctx.getBindingContext();
    DCDataControl dc = bctx.findDataControl("UploadedFilesServiceDataControl");
    UploadedFilesService service = (UploadedFilesService)dc.getDataProvider();
    service.saveRowUploadedFilesView();
    catch ( Exception ex )
    // required by fSource.getInputStream();
    ex.printStackTrace();
    } // onUpload
    protected void findForward(DataActionContext actionContext) throws Exception {
    System.out.println("*** UploadDocumentAction.findForward() ***");
    // Try to catch errors instead of the default error handler.
    try {
    List events = actionContext.getEvents();
    if (events != null && events.size() > 0) {
    ListIterator li = events.listIterator();
    while (li.hasNext()) {
    System.out.println("UploadDocumentAction.findForward()- event : " + li.next().toString());
    } catch (Exception e) {
    System.out.println(e.getMessage() );
    e.printStackTrace(System.out);
    super.findForward(actionContext);
    /* UploadedFilesViewRowClient.java */
    public class UploadedFilesViewRowClient extends RowImpl
    * This is the default constructor (do not remove)
    public UploadedFilesViewRowClient() {}
    public oracle.jbo.domain.Number getId() {
    return (oracle.jbo.domain.Number)getAttribute("Id");
    public void setId(oracle.jbo.domain.Number value) {
    setAttribute("Id", value);
    public String getFilename() {
    return (String)getAttribute("Filename");
    public void setFilename(String value) {
    setAttribute("Filename", value);
    public oracle.jbo.domain.BlobDomain getContent() {
    return (oracle.jbo.domain.BlobDomain)getAttribute("Content");
    public void setContent(oracle.jbo.domain.BlobDomain value) {
    setAttribute("Content", value);
    public oracle.jbo.domain.Date getDateCreated() {
    return (oracle.jbo.domain.Date)getAttribute("DateCreated");
    public void setDateCreated(oracle.jbo.domain.Date value) {
    setAttribute("DateCreated", value);
    public oracle.ord.im.OrdDocDomain getTempOrdDocDomain() {
    return (oracle.ord.im.OrdDocDomain)getAttribute("TempOrdDocDomain");
    public void setTempOrdDocDomain(oracle.ord.im.OrdDocDomain value) {
    setAttribute("TempOrdDocDomain", value);
    /* UploadedFilesServiceImpl.java */
    public void insertRowIntoUploadedFilesView() {
    //vo is your view object
    ViewObject vo = getUploadedFilesView1();
    Row aRow = vo.createRow();
    aRow.setNewRowState(Row.STATUS_INITIALIZED);
    /* Do these get populated automatically? Yes! since setup in entity as historical */
    vo.insertRow(aRow);
    vo.setCurrentRow(aRow);
    // getTransaction().commit();
    public void saveRowUploadedFilesView() {
    //vo is your view object
    ViewObject vo = getUploadedFilesView1();
    getTransaction().commit();
    ...

Maybe you are looking for

  • Error -48 with itunes

    Itunes appears to function just fine, but I occasionally get error -48 unable to safe library. The library appears to be where it belongs and functions OK.

  • Find no of week in a month of particular date in crystal report

    dear sir i have to find out the *no of week in a particular month against the particular date in crystal report* . i am trying this formula but it will give me a no of week from january .but i want the week no of that date only in my report.pls assum

  • IBook and Mac mini

    Hello users... I'd like to know if anyone has helpful information as to whether my iBook G4 can or will Communicate BETTER with my mac mini? I know that they are totally different operating systems but my iBook is perfectly fine and works great, plus

  • Split Invoice due to different delivery address.

    Hi, I have an issue because I want to create only one invoice from two deliveries also from the same sales order. The system doesnu2019t create only one invoice due to the different delivery address in the Ship to party, the code is the same however

  • Default Backflush indicator as 1

    Dear Masters , At the time of creating a new material of type ROH & HALB , how to set the backflush indicator of material as '1 'by default in MRP2 view ? Thanks, Sachin