File Upload Download Application- Query cannot be parsed within the Builder

Posting for those who encounter this problem.
In the section "Store the Document in a Custom Table", you will encounter a problem with the SQL:
if ( :P2_FILE_NAME is not null ) then
insert into file_subjects(id,NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE)
select id,:P2_FILE_NAME,:P2_SUBJECT,blob_content,mime_type
from wwv_flow_files where name = :P2_FILE_NAME;
delete wwv_flow_files where name = :P2_FILE_NAME;
end if;
The problem is that the BLOB_CONTENT column has not been initialised with and empty BLOB locator.
I modified the SQL as follows. If there is a better way of doing this please post.
if ( :P2_FILE_NAME is not null ) then
insert into file_subjects(id,NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE)
select id,:P2_FILE_NAME,:P2_SUBJECT,EMPTY_BLOB(),mime_type
from wwv_flow_files
where name = :P2_FILE_NAME;
insert into file_subjects(blob_content)
select blob_content
from wwv_flow_files
where name = :P2_FILE_NAME;
delete from wwv_flow_files where name = :P2_FILE_NAME;
end if;

Does your parsing schema have direct granted privileges to execute the function or privileges via a role? If it is through a role, you need to directly grant execute on the function to your parsing schema.
Mike

Similar Messages

  • Query cannot be parsed within the Builder ORA-00900: invalid SQL statement

    Why am I getting the error message "Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00900: invalid SQL statement"
    If I run the query in sqlplus it comes back with "no rows selected" which is what I want.
    The function is valid and the user has privileges to run it.
    Is there something I can do about it?
    If I only have any field instead of the function the error goes away.
    Can someone explain what is happening? I'm using 2.0.
    select
    F_TOTAL_AMOUNT_PAID('fees',a.acct_fee_id,0) "Fee Paid"
    from fee_component a, fee b, license c
    where a.acctfee_id = b.acctfee_id
    and b.license_id = c.license_id
    and b.fee_status = 'U'
    and c.client_id = :P301_CLIENT_ID
    Thanks I really appreciate any help I can get.

    Does your parsing schema have direct granted privileges to execute the function or privileges via a role? If it is through a role, you need to directly grant execute on the function to your parsing schema.
    Mike

  • Query Cannot be Parsed Within Builder

    Hi,
    I'm trying to parse different Oracle database connections so users can do a search by database. I am setting this up in the HTML DB and have set up the appropriate Item which is P"(_HUB and within this I have set up the List Of Values.
    However, I get the following error:
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. The query can not be parsed, the cursor is not yet open or a function returning a SQL query returned without a value.
    declare
    v_sql varchar2(4000);
    pshub varchar(15) := 'P29_HUB';
    begin
    v_sql := 'SELECT CLIENTACC.CLIENTID, CLIENTACC.ACCOUNT, CLIENTACC.ACCOUNTDESC, CLIENTACC.BACKOFFACCOUNT from CLIENTACC@'||pshub||'';
    end;
    Can someone please advise.
    Cheers.

    As I see in the query(v_sql) , you missed the quotes ;
    Try this now :
    declare
    v_sql varchar2(4000);
    pshub varchar(15) := 'P29_HUB';
    begin
    v_sql := 'SELECT CLIENTACC.CLIENTID, CLIENTACC.ACCOUNT, CLIENTACC.ACCOUNTDESC, CLIENTACC.BACKOFFACCOUNT from CLIENTACC@''||pshub||'' ';
    end;

  • 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

  • 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

  • File Upload/Download storing in ECC

    hi Guys,
    Using webdynpro abap application I am uploading a file.I want to store this file in the backend database(R/3). I am not able to stroe the Xstring value to the table.
    So I have made my table with field with  data type as string.
    Is there an standard function module to convert Xstring to String.
    Because in another webdynpro application I want to download the file which was uploaded so we require a function module to convert string to xstring again.
    Tell me how to store the Xstring data of the file to database tabel and agian download it.
    Regards,
    Shamila.

    Hi,
    Chek this standard document
    http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm
    Also check these forum threads
    Re: download a file
    File Upload/Download
    File download in Local PC
    Re: File Download to Excel
    for file upload control you can look at WDR_TEST_EVENTS component

  • Newbie: Application descriptor cannot be parsed error 100

    Here's my descriptor file:
    <?xml version=1.0" encoding ="UTF-8"?>
    <application xmlns="http://ns.adobe.com/air/application/1.5.1">
        <id>myTest</id>
        <filename>myTest</filename>
        <description>A simple AIR hello world application</description>
        <version>0.1</version>
        <initialWindow>
            <content>myTest.html</content>
            <title>AIR Hello World</title>
            <systemChrome>standard</systemChrome>
            <transparent>false</transparent>
            <visible>true</visible>
            <minimizable>true</minimizable>
            <maximizable>true</maximizable>
            <resizable>true</resizable>
        </initialWindow>
    </application>
    and here's the error I'm getting
    /Volumes/My Book/Air Applications/myTest.html: error 100: Application descriptor cannot be parsed
    Can anyone help?

    Stupid error.  Forgot a quote in the first line.  Fixed it, but I have another problem now that I'll ask in another thread.

  • My file upload java application working fine in tomcat 7  but not working in weblogic 11

    Hi All,
    My  file upload  java application  successfully run in tomcat 7 . But  I could not run it in Weblogic 11.   Getting following error message   . Please help.
    Please contact your administrator.org.springframework.beans.NullValueInNestedPathException: Invalid property &#039;fileData[0]&#039; of bean class [com.techm.util.UploadItem]: Cannot access indexed value in property referenced in indexed property path &#039;fileData[0]&#039;: returned null
      at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:681)
      at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:651)
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
      at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:587)
      at org.springframework.validation.DataBinder.doBind(DataBinder.java:489)
      at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:149)
      at org.springframework.web.bind.ServletRequestDataBinder.bind(ServletRequestDataBinder.java:110)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.doBind(AnnotationMethodHandlerAdapter.java:566)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:213)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

    What version of spring are you using in tomcat?
    What version of WLS are you using.
    What JDK are you using in both environments?
    Is the issue random? or can you reproduce it at will?
    Thanks
    Luz

  • Query cannot be parsed....

    I am completing the Day application express and I am having a basic problem in Modifying the Department report (p38 and 39 of the PDF documentation).
    We're supposed to change the sql code by the following:
    SELECT d.DEPARTMENT_ID,
    d.DEPARTMENT_NAME,
    (select count(*)from oehr_employees where department_id = d.department_id)
    "Number of Employees",
    substr(e.first_name,1,1)||'.'||e.last_name "Manager Name",
    c.COUNTRY_NAME "Location"
    FROM OEHR_DEPARTMENTS d,
    OEHR_EMPLOYEES e,
    OEHR_LOCATIONS l,
    OEHR_COUNTRIES c
    WHERE d.LOCATION_ID=l.LOCATION_ID
    AND l.COUNTRY_ID=c.COUNTRY_ID
    AND d.DEPARTMENT_ID=e.department_id
    AND d.manager_id=e.employee_id
    AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_
    SEARCH,d.department_name)))>0
    When I apply changes I have the following message:
    Query cannot be parsed, please check the syntax of your query. (ORA-00909: invalid number of arguments)
    Any idea ?
    Thanks in advance for your help.

    Hi,
    It looks like there is a new line in wrong place:
    SELECT d.DEPARTMENT_ID,
    d.DEPARTMENT_NAME,
    (select count(*)from oehr_employees where department_id = d.department_id)
    "Number of Employees",
    substr(e.first_name,1,1)||'.'||e.last_name "Manager Name",
    c.COUNTRY_NAME "Location"
    FROM OEHR_DEPARTMENTS d,
    OEHR_EMPLOYEES e,
    OEHR_LOCATIONS l,
    OEHR_COUNTRIES c
    WHERE d.LOCATION_ID=l.LOCATION_ID
    AND l.COUNTRY_ID=c.COUNTRY_ID
    AND d.DEPARTMENT_ID=e.department_id
    AND d.manager_id=e.employee_id
    AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_  --- <-- !!!
    SEARCH,d.department_name)))>0it should be:
    SELECT d.DEPARTMENT_ID,
    d.DEPARTMENT_NAME,
    (select count(*)from oehr_employees where department_id = d.department_id)
    "Number of Employees",
    substr(e.first_name,1,1)||'.'||e.last_name "Manager Name",
    c.COUNTRY_NAME "Location"
    FROM OEHR_DEPARTMENTS d,
    OEHR_EMPLOYEES e,
    OEHR_LOCATIONS l,
    OEHR_COUNTRIES c
    WHERE d.LOCATION_ID=l.LOCATION_ID
    AND l.COUNTRY_ID=c.COUNTRY_ID
    AND d.DEPARTMENT_ID=e.department_id
    AND d.manager_id=e.employee_id
    AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_SEARCH,d.department_name)))>0Lev
    Edited by: le on Jul 2, 2010 10:14 AM

  • HT4854 where is the file I downloaded? I cannot always download 4 Gigs again. Too costly here in South Africa

    where is the file I downloaded? I cannot always download 4 Gigs again. Too costly here in South Africa

    If you haven't run the installer yet, it is sitting in your /Applications folder. If you have run it, I'm afraid its already gone. When you run the installer, it self deletes.
    To avoid this, you have to make a copy of the installer.app BEFORE you install (in other words, after the download completes and the installer app automatically starts, quit it, then go to /Applications and copy 'Install Mountain Lion.app').

  • Error in creating upload/download application

    Hi,
    I am trying to create the Howto:Upload/download application and got this error when I browse the file and select submit. Can you please help me to find out why I got this error?
    Thanks,
    Mon, 12 Apr 2004 18:15:58 GMT
    ORA-00942: table or view does not exist
    DAD name: demo
    PROCEDURE : wwv_flow.accept
    URL : http://testserver:80/pls/demo/wwv_flow.accept
    PARAMETERS :
    ===========
    ENVIRONMENT:
    ============
    PLSQL_GATEWAY=WebDb
    GATEWAY_IVERSION=2
    SERVER_SOFTWARE=Apache/1.3.12 (Win32) ApacheJServ/1.1 mod_ssl/2.6.4 OpenSSL/0.9.5a mod_perl/1.22
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PORT=80
    SERVER_NAME=testserver
    REQUEST_METHOD=POST
    QUERY_STRING=
    PATH_INFO=/pls/demo/wwv_flow.accept
    SCRIPT_NAME=/pls
    REMOTE_HOST=
    REMOTE_ADDR=10.10.2.217
    SERVER_PROTOCOL=HTTP/1.1
    REQUEST_PROTOCOL=HTTP
    REMOTE_USER=
    HTTP_CONTENT_LENGTH=24043
    HTTP_CONTENT_TYPE=multipart/form-data; boundary=---------------------------7d45b3a4013c
    HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    HTTP_HOST=testserver
    HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, */*
    HTTP_ACCEPT_ENCODING=gzip, deflate
    HTTP_ACCEPT_LANGUAGE=en-us
    HTTP_ACCEPT_CHARSET=
    HTTP_COOKIE=LOGIN_USERNAME_COOKIE=james; ORACLE_PLATFORM_REMEMBER_UN=janes:james; WWV_FLOW_USER2=4D86B80558A076CE; WWV_CUSTOM-F_604016577451304_100=-1; WWV_CUSTOM-F_604016577451304_104=4D86B80558A076CE
    Authorization=
    HTTP_IF_MODIFIED_SINCE=

    it sounds as if your DAD is referencing a table for its DocumentTablename that doesn't exist. the correct doc table for a supported installation of htmldb is "wwv_flow_file_objects$". my default install of htmldb created a dad like this...
    <Location /pls/htmldb>
    SetHandler pls_handler
    Order deny,allow
    Allow from all
    AllowOverride None
    PlsqlDatabaseUsername HTMLDB_PUBLIC_USER
    PlsqlDatabasePassword %html_db_public_user_pwd%
    PlsqlDatabaseConnectString ap6002wgs.us.oracle.com:1521:apwgs ServiceNameFormat
    PlsqlDefaultPage htmldb
    PlsqlDocumentTablename wwv_flow_file_objects$
    PlsqlDocumentPath docs
    PlsqlDocumentProcedure wwv_flow_file_manager.process_download
    PlsqlAuthenticationMode Basic
    PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
    </Location>
    ...and, again, it sounds as if your "demo" DAD is pointing to something other than wwv_flow_file_objects$. can you check your DAD, please, and let us know if correcting that doesn't fix things for you? also, so you know, that how-to doc assumes that you're using a supported configuration of htmldb. aside from what installs from the 10g companion CD, the only other two supported configurations are mapped out at...
    http://otn.oracle.com/products/database/htmldb/howtos/howto_useoas10g.html
    ...and...
    http://otn.oracle.com/products/database/htmldb/howtos/howto_use9ir2ohs.html
    ...so your "demo" dad should match what's in there.
    thanks,
    raj

  • Urgent : file upload / download functionality in oracle portal page

    Hi friends
    I am new to portal development and am working on oracle portal 9i rel2 . I need to know how to put the file upload and download functionality in any page. the functionality given in oracle portal user guide is not user friendly (i.e in the content area add item of type file" ) .... i need to now is their any way to achieve the simple , one button click upload download functionality ..like we do in yahoo mails etc.
    any help will be highly appreciated.
    regards
    Dheeraj

    Well, I do not know the exact location of the document, however you can find the document to do this in modplsql User Guide ..(File Upload/Download).
    I am pasting some hint:
    e.g.
    Create an html form..code something like this:
    <html>
    <head>
    <title>test upload</title>
    </head>
    <body>
    <FORM      enctype="multipart/form-data"
    action="pls/mydad/write_info"
    method="POST">
    <p>Author's Name:<INPUT type="text" name="who">
    <p>Description:<INPUT type="text" name="description"><br>
    <p>File to upload:<INPUT type="file" name="file"><br>
    <p><INPUT type="submit">
    </FORM>
    </body>
    </html>
    Create a table
    (who varchar2(..).
    description varchar2(..),
    file varchar2(..));
    Your procedure something like this:
    procedure write_info (
    who in varchar2,
    description in varchar2,
    file in varchar2) as
    begin
    insert into myTable values (who, description, file);
    htp.htmlopen;
    htp.headopen;
    htp.title('File Uploaded');
    htp.headclose;
    htp.bodyopen;
    htp.header(1, 'Upload Status');
    htp.print('Uploaded ' || file || ' successfully');
    htp.bodyclose;
    htp.htmlclose;
    end;
    You should be able to download/access the file using the following URL format:
    http://<host>:<port>/pls/<dad>/docs/<file_name>
    Where file name is = Look for the value in the "myTable" > file.
    Do tell how you get on this.
    Thanx,
    Chetan.

  • File upload & download through web Dynpro

    Hai All,
         Now i am working in webDynpro 2.0.9. For file upload
    and download through webdynpro "resource" is used.But in my webdynpro version 2.0.9. "resource" is not possible.so tell me how to upload & download by using this version & what is the alternative way for this.
    Thanks in advance.
    Kindly Regards,
    s.v.selva bala

    HI,
    Try out this code :
    FileInputStream is = new FileInputStream(file);
          long length = file.length();
          byte[] bytes = new byte[(int)length];
          long bytesRead = is.read(bytes);
          if (bytesRead < length)
           throw new IOException("Could not completely read file "+file.getName());
          is.close();
    element.setDocumentContent(bytes);
    Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
    Regards
    Sid

  • 2-way file upload/download b/w client/server

    I need help for a good design strategy for 2-way file upload/download betweeen client and server.
    I have to upload a set of files to the server (which is a servlet)
    and again the servlet downloads another set of files to the client (which is an applet)
    I could find a solution to this problem only to a certain extent (i.e) I can upload any no.of files to the servlet from applet but the servlet can download only a single file to the applet.
    But now the requirement needs the servlet to be able to send more than one file. I am not going anywhere ahead from this point since last 2 days.
    I have used ObjectOutputStream-ObjectInputStream objects at both ends for communcation and sending the files as bufferes of 128 size. But this is becoming more complicated to manage the streams!!
    if anyone of you have done this before please help with this!
    Thaks
    sri

    Give this a try.
    1) construct
    2) call ZipDocVO.add(Serializable) for each obj that you wish to send.
    3) call ZipDocVO.zip() to zip it up when you are finished adding objects.
    4) send the ZipDocVO, using ObjectOuputStream or whatever
    5) call ZipDocVO.unzip()
    6) call ZipDocVO.getDocuments() to access your objects
    import java.io.*;
    import java.util.zip.*;
    import java.util.*;
    public class ZipDocVO implements Serializable {
         private List     vos;
         private byte[]     rawData;
         private boolean     isZipped;
         public ZipDocVO( byte botype, int key )
              vos = new ArrayList();
         public List getDocuments() { return vos; }
         public void add( Serializable doc ) { vos.add( doc ); }
         private boolean isZipped() { return isZipped; }
         public void zip() {
              if( isZipped() ) {
                   System.out.println( "Already zipped!" );
              else {
                   try {
                        // First zip our documents
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        GZIPOutputStream gzos = new GZIPOutputStream( baos );
                        ObjectOutputStream oos = new ObjectOutputStream( gzos );
                        oos.writeObject( vos );
                        oos.close();
                        // Then get rid of the unzipped versions
                        rawData = baos.toByteArray();
                        vos = null;
                        isZipped = true;
                   catch( IOException ioe ) {
                        System.out.println( "Unable to zip : " +ioe.getMessage());
         public void unzip() {
              if( !isZipped() ) {
                   System.out.println( "Not zipped!" );
              else {
                   try {
                        // First unzip our documents
                        ByteArrayInputStream bais = new ByteArrayInputStream( rawData );
                        GZIPInputStream gzis = new GZIPInputStream( bais );
                        ObjectInputStream ois = new ObjectInputStream( gzis );
                        vos = (ArrayList)ois.readObject();
                        ois.close();
                        // Then get rid of the zipped versions
                        rawData = null;
                        isZipped = false;
                   catch( Exception e ) {
                        System.out.println( "Unable to unzip : " +e.getMessage());
    }

  • File Uploads/Downloads

    I have an HP Pavillion Desktop with Windows 7 operating system. I think one of my children has disabled something because when I click on anything to do a file upload/download, I can't access my Desktop or any files on it. Help!

    Hi,
    The easiest way to solve this may be to run Windows System Restore.  First, copy any files currently on your Desktop, paste them into a new folder, then cut and paste the folder in to your Documents folder.
    Once you've done this, shut down the PC.  Windows System Restore is usually best run in Safe Mode.  Tap away at f8 as you start the PC to enter Windows Recovery Console.  Use the arrow keys to select Safe Mode and hit enter.  When this has loaded, from the Start Menu, click All Programs, click Accessories, click System Tools and launch System Restore.  Pick a restore point before at least 24 hours before this issue and then proceed with the restore process.  When complete, Windows will reboot as normal.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

Maybe you are looking for