Upload files into a .war file

Hi,
I`m working in a webapp that upload a file from a client browser into a
directory inside the structure of my aplication. This looks like :
MyApp\targetdirectory
I`m using getServlet().getServletContext().getRealPath("/") to get the real
path of root of MyApp and then upload the file ...
Everything work when I`m working with the "exploded" structure but it fails
when I deploy it in weblogic as part of a .war file.
Tomcat seems to handle this "exploding" the .war file at deploying time ...
does weblogic has something similar ?
regards,
Hans Nemarich
ORDEN
www.orden.cl

This has been discussed before if you search back ... generally, you should
NOT be doing what you described.
Peace,
Cameron Purdy
Tangosol Inc.
Tangosol Coherence: Clustered Coherent Cache for J2EE
Information at http://www.tangosol.com/
"Hans Nemarich" <[email protected]> wrote in message
news:[email protected]..
Hi,
I`m working in a webapp that upload a file from a client browser into a
directory inside the structure of my aplication. This looks like :
MyApp\targetdirectory
I`m using getServlet().getServletContext().getRealPath("/") to get thereal
path of root of MyApp and then upload the file ...
Everything work when I`m working with the "exploded" structure but itfails
when I deploy it in weblogic as part of a .war file.
Tomcat seems to handle this "exploding" the .war file at deploying time...
does weblogic has something similar ?
regards,
Hans Nemarich
ORDEN
www.orden.cl

Similar Messages

  • Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q with a real time mode but it is not working but when i run it with uploading it into the PXI it save in to the file

    Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q and DAQ NI PXI-6229 with a real time mode but it is not working but when i run it without uploading it into the PXI it save in to the file please find attached my vi
    Attachments:
    PWMs.vi ‏130 KB

     other problem is that the channel DAQmx only works at real time mode not on stand alone vi using Labview 8.2 and Real time 8.2

  • How to check if a file (picture) exists into a war?

    Hello, I have made a Java/J2EE project using countries in the world and I have at my disposition a folder of flags icons.
    Some countries don't have any flag icon for any reason and in my application, I'll be able to add new ones.
    In my code, I want to do display the flag of the current country if available else display a default icon.
    Here is what I am currently doing:
    String contextPath = facesContext.getExternalContext().getRequestContextPath();
    String flagUrl = contextPath + "/images/flags/"+ name.trim().toLowerCase() + ".png";
    boolean exists = (new File(flagUrl)).exists();The issue is exists is always set to true no matter the existence of the flag.
    Here is what my variable nammed flagUrl looks like : /images/flags/ca.png
    How do you check the existence of a file into a war? Thank you
    Edited by: cotede3 on Mar 11, 2010 5:32 AM

    Unfortunately I cannot call getRealPath on application.
    application in my code is :
    BBrApplication application = null;
              // Searchs entity class icon
              FacesContext facesContext = FacesContext.getCurrentInstance();
              if (facesContext != null)
                   application = BBrApplication.getInstance(facesContext);So I tried
    String realFilePath = application.getContextRoot();but I end up with
    realFilePath = /DFP/.
    so It is not the absolute path displayed...
    How can I do ?

  • Error while uploading file into KM

    Hi Experts,
    I m getting error while uploading file into KM. Its throwing an error message like " Syngenta-POC.doc" does not exist, or file is empty; you cannot upload empty files"
    please assists me.

    Shantanu,
    Please check the files which you are upload is empty or unknown format. If everything seems valid then try to check for the corresponding SAP Note in service.sap.com
    Ram

  • Wiki file attachments - can the wiki be configured to link to a file already on the server rather than uploading it into the page?

    Can the wiki be configured to link to a file already on the server rather than uploading it into the page? This would enable users to open (and edit) the original server hosted document rather than downloading a static copy that can't be edited and synced back into the wiki page.
    As a workaround I've tried attaching an alias to a file but it doesn't work - the wiki instead uploads the aliased file.
    From what I can work out, the default wiki behaviour is to upload a document to a wiki page, which creates a copy of the uploaded document in the wiki database. This copy has no connection to the original document. It can be downloaded and edited, but the edits are not saved back into the wiki hosted version of the document.
    I'd like to be able to upload a link or alias to a document (with preview please!) already on the server. A user could then preview the document or click to open and edit it.
    The only way I can do this at the moment is to create a link "afp://123.../doc.rtf" to the original. This is timeconsuming and confusing for non-technical users and doesn't offer the benefits of the attach function (ie document preview).
    Is there any way the wiki can be configured to link to documents already on the server using the attach functionality?

    An update for anyone in a similar situation.
    Patch 3944727 for 9.0.4.1 that solves this issue: "USER LOV IASM11SHIP EDIT USER LOV SHOULD SHOW THE NICKNAME ATTRIBUTE." However, the patch is mutually exclusive with the latest CPU's and there's no plan to merge the pacthes given the dwindling support for 9.0.4.1. So that patch is pretty much worthless.
    I've been told that this patch is included in newer portal versions, so the real solution is an upgrade.
    Trenton

  • Uploading file to the servelet and write directly into database

    i want client to upload file to the server (using servlet for that) and i just don't want to store it to the hard disk, but i want to write it
    into the the ms sql database (that i m using).
    TIA

    Here is a good site for learning how to upload a file using a servlet:
    http://www.servlets.com/cos/index.html
    Once you get the file in the servlet you shouldn't have any problem storing it to a DB.

  • Uploading data into a fixed length file

    hello experts,
    I got  a task to upload data into a fixed length positional file from internal table.So  please help me.
    regards,
    sriram.

    Hi there.  What you basically need to do is set up the path and name for the export file, move your records to an output table, and then transfer the data to the file that you have specified.  We usually set up our export programs so that the user can choose to download the file locally or onto the application server.  So first we define the following fields on the selection screen:
    PARAMETERS: p_file(128) LOWER CASE OBLIGATORY. "File
    *path name from system standard
    PARAMETERS: p_path LIKE rlgrap-filename MODIF ID fpn.  "Path Name
    PARAMETERS: p_local AS CHECKBOX.  "Local File Flag
    Then we use this to set the path to the application server:
    INITIALIZATION.
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = 'Z_AO_HR_UP_LOAD'
          parameter_1      = space
        IMPORTING
          emergency_flag   = lw_emergency_flag
          file_name        = p_path
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
    AT SELECTION-SCREEN OUTPUT.
    make path name display only
      LOOP AT SCREEN.
        CHECK screen-group1 = 'FPN'.
        screen-input = 0.                  "Output (Display) only
        MODIFY SCREEN.
      ENDLOOP.
    After your START-OF-SELECTION statement, you need to open the file for output:
      IF p_local NE ztc_on.
    Get Path/file Name using logical filename.
          CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = 'Z_AO_HR_UP_LOAD'
          parameter_1      = p_file
        IMPORTING
          emergency_flag   = lw_emergency_flag
          file_name        = p_path
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
        IF sy-subrc <> 0.
          w_message = 'No Output file - Missing Logical File Z_AO_HR_UP_LOAD'.
          WRITE: / w_message.
          IF sy-batch = 'X'.               "Is this in a job?
            NEW-PAGE.
            PERFORM end_of_selection.
            MESSAGE e000(38) WITH w_message. "This causes the job to cancel
          ELSE.
            MESSAGE i000(38) WITH w_message.
          ENDIF.
          w_stop = 'X'.
          STOP.
        ENDIF.
    *Check if output file is already present.
        OPEN DATASET p_path FOR INPUT IN TEXT MODE.
        IF sy-subrc EQ 0.
          CLOSE DATASET p_path.
          WRITE: 'Output Data file already present ', p_path.
    *Use the following for logging error message
          CONCATENATE 'Ouput Data file already present ' p_path INTO
                       w_message.
          IF sy-batch = ztc_on.            "Is this in a job?
            NEW-PAGE.
            PERFORM end_of_selection.
            MESSAGE e000(38) WITH w_message. "This causes the job to cancel
          ELSE.
            MESSAGE i000(38) WITH w_message.
          ENDIF.
          w_stop = 'X'.
          STOP.
        ENDIF.
        OPEN DATASET p_path FOR OUTPUT IN TEXT MODE.
        IF sy-subrc <> 0.
          WRITE: 'Unable to open output dataset - ', p_path.
    *Use the following for logging error message
          CONCATENATE 'Unable to open output dataset - ' p_path INTO
                       w_message.
          IF sy-batch = ztc_on.            "Is this in a job?
            NEW-PAGE.
            PERFORM end_of_selection.
            MESSAGE e000(38) WITH w_message. "This causes the job to cancel
          ELSE.
            MESSAGE i000(38) WITH w_message.
          ENDIF.
          w_stop = 'X'.
          STOP.
        ENDIF.
      ENDIF.
    Next you perform all of the steps to put your data in the internal table. After the end of selection we then transfer the data from the original internal table (which has many separate fields defined) to a second internal table, t_outfile, in which each record has a single field that is the total length of the original itab record:
    *Internal table for Output data
    DATA : BEGIN OF t_outfile OCCURS 0,
             text(1000).
    DATA : END OF t_outfile.
    Then you can download your file, checking whether it goes to a local drive or the application server:
      IF p_local EQ ztc_on.
          CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = p_file
        TABLES
          data_tab                = t_outfile
        EXCEPTIONS
          file_open_error         = 1
          file_write_error        = 2
          invalid_filesize        = 3
          invalid_table_width     = 4
          invalid_type            = 5
          no_batch                = 6
          unknown_error           = 7
          gui_refuse_filetransfer = 8
          OTHERS                  = 9.
      ELSE.
        LOOP AT t_outfile.
          TRANSFER t_outfile TO p_path.
        ENDLOOP.
      ENDIF.
    Now close your dataset if it is on the application server:
    IF p_local NE ztc_on.
          CLOSE DATASET p_path.
        ENDIF.
    I hope this helps!
    - April King

  • Issue with permissions to upload files into Apache web server to OS 10.8.2

    Hello everyone;
    I setted up Apache web server and mysql to OS 10.8.2 Mountain Lion. It's working fine except for the permissions. I can't upload files into the web site directory. Doesn't recognize, e.g., the PHP function "move_uploaded".
    One problem for my is that I can't modify the permissions by "Terminal" app since it telling me that the "Process completed" and I can't write any script.
    Any suggestion will be welcome.
    Thanks in advance.

    My only question now would be how to speed up Safari's 6.0.1 performance in 10.8.2 or do I just accept that it's a little slower than it was, which is fine. Are other folks having this issue?
    I was primarily passing along info about my particular download speed and for the Web Confidential 3.8 people: make a backup of your passwords b4 installing 10.8.2 or be prepared to upgrade.

  • Someone used upload files into blob in JDeveloper 10.1.3.2 ?

    Someone used upload files into blob in JDeveloper 10.1.3.2 ?
    I used Steve Muech example 85, but after downloading , downloaded files doesn't work ?
    I prepared test case http://www.sttb.pl/jakub/UploadAndDownloadBlob.zip - meybe someone resolve it.
    Regards
    Kuba

    Hi,
    There is no problem with download in above example. I have used Steve's example to upload, and solution delivered by Ric Smith on his blog to download files. I think there is something wrong with Steve's uploading solution. When I used Ric solution (he sent me by email complete JDeveloper project) to upload and download everyting works correct. I created last Friday SR on Metalink to review it and it's still in progress. My advice is:
    1) Look onto Ric Smith blog:
    http://thepeninsulasedge.com/blog/2006/08/17/reading-and-writing-blobdomains-to-and-from-an-adf-uploadfile/
    and
    http://thepeninsulasedge.com/blog/2006/11/06/adf-faces-and-adf-bc-fileupload-and-blobs-continued/
    2) Ask him to send JDeveloper project or update email to your profile - I'll send you directly this project that I retrieved from Ric Smith
    Regards
    Kuba

  • Upload Files into SAP Office Folder in Background

    Hi All ,
    Has anyone tried uploading file(s) of any type say *.XLS , *.PDF to SAP office folder (Outbox) in the background . I am using the function module  'SO_DOCUMENT_REPOSITORY' with methods "SAVE" , "ATTCREATEFROMPC" and "SEND" . It works fine in foreground without any errors . But when tried to schedule in background , the job stops at the method call "ATTCREATEFROMPC" and gives a message  "Database error for <INSERT INTO KPRO> " . It looks like the uderlyiong function module checks for an active GUI and fails during background .
    Any thoughts or other solutions would be appreciated ....
    Thanks

    Hi,
    I think ATTCREATEFROMPC method is for loading the file from frontend PC. It is bound to fail if you run it in background since there is no SAPGUI running it and it can't know the location.
    You will need to use some other method to be able to read the files from the APP server, and have your documents on the APP server if you want to run your code in the background.
    cheers,
    Ajay

  • HT201317 When I view photos on my devices some are not oriented correctly. I used Picassa to turn all photos upright and then copied those photos into the upload file but they are still not corrected when viewed on my devices (ipads)

    When I view photos on my devices some are not oriented correctly. I used Picassa to turn all photos upright and then copied those photos into the upload file but they are still not corrected when viewed on my devices (ipads)

    Generally I would not use Facebook for sharing any photos, it compresses the photos substantially, and when you have shadows and dark colours you get visible "bands" where there should be subtle gradients, ie at sunsets and sunrises.
    It sounds like you are using two methods to upload to Facebook:
    1. Sharing from within Aperture, which basically syncs Facebook with your Aperture album, so any changes made at either end gets synced, hence the deletions from Albums, although the original file should still be in your library, just removed rom the album. It is like a playlist in iTunes.
    2. Exporting pics and uploading to Facebook from the browser.
    I am not sure how method 1 gets compressed, but I know that uploading hi-res jpegs to Facebook using method 2 results in poor quality images.
    I wouldn't even bother comparing option 1 or 2, and they will both be poor images once you view them on Facebook, as opposed to viewing uploaded images on proper image sharing / hosting sites.
    Your problem is not with Aperture, it is using Facebook for showing your work.
    If you export pics form Aperture at high res jpegs or TIFFs your images will be fine.
    If you insist to use Facebook as your way to share your work, then your workflow should be this:
    1. Right click images you want to share.
    2. Select Export version.
    3. Export as 100% size and ensure the export settings are set at 100% quality.
    4. Upload this pic into Facebook.
    This will get you the best image size and resolution on Facebook.
    See how you go.

  • Upload file into db,sos!

    I am working on upload into and download from database. I am
    using jspsmartupload api.
    Please help me any one worked on this api.. I am getting an
    error like
    An error occurs : java.sql.SQLException: Internal Error: Unable
    to construct a Datum from the specified input 0 file(s) uploaded
    in the database
    When the file size is less then 4KB.. and I am getting an error
    like this when the file size is grater then 4KB I am getting an
    error like this..
    An error occurs : java.sql.SQLException: ORA-01008: not all
    variables bound
    When I was trying to insert a row into database by using result
    set by using
    rs.moveToInsertRow();
    rs.insertRow();
    I am getting another error like
    java.sql.SQLException: Io exception: Connection reset by peer:
    JVM_recv in socke
    t input stream read
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java)
    at oracle.jdbc.driver.OracleResultSetImpl.internal_close
    (OracleResultSet
    Impl.java)
    at oracle.jdbc.driver.OracleResultSetImpl.close
    (OracleResultSetImpl.java
    at oracle.jdbc.driver.ScrollableResultSet.close
    (ScrollableResultSet.java
    at oracle.jdbc.driver.UpdatableResultSet.close
    (UpdatableResultSet.java)
    at examples.jsp.smart.sample4_jsp_1._jspService
    (sample4_jsp_1.java:166)
    at com.sun.jsp.runtime.HttpJspBase.service
    (HttpJspBase.java:87)
    at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:840)
    at
    com.sun.jsp.runtime.JspServlet$JspServletWrapper.service
    (JspServlet.j
    ava:88)
    at com.sun.jsp.runtime.JspServlet.serviceJspFile
    (JspServlet.java:218)
    at com.sun.jsp.runtime.JspServlet.service
    (JspServlet.java:294)
    at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:840)
    at com.sun.web.core.ServletWrapper.handleRequest
    (ServletWrapper.java:155
    at com.sun.web.core.Context.handleRequest
    (Context.java:414)
    at com.sun.web.server.ConnectionHandler.run
    (ConnectionHandler.java:139)
    HANDLER THREAD PROBLEM: java.io.IOException: Socket Closed
    java.io.IOException: Socket Closed
    at java.net.PlainSocketImpl.getInputStream(Unknown
    Source)
    at java.net.Socket$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native
    Method)
    at java.net.Socket.getInputStream(Unknown Source)
    at com.sun.web.server.ConnectionHandler.run
    (ConnectionHandler.java:161)
    Here is the code..
    ResultSet rs = stmt.executeQuery("SELECT Ta.* FROM
    MP1.TBL_UPLOAD Ta where ID =1");
    // if the resultset is not null
    if (rs.next()){
    // Initialization
    mySmartUpload.initialize(pageContext);
    // Upload
    mySmartUpload.upload();
    // upload file in the DB if this file is not
    missing
    if (!mySmartUpload.getFiles().getFile
    (0).isMissing()){
    try {
    file://rs.moveToInsertRow();
    file://rs.updateInt("ID",2);
    rs.updateString("FILENAME",
    mySmartUpload.getFiles().getFile(0).getFileName());
    // Add the current file in the
    DB field
    System.out.println("I am before
    update Row()" + mySmartUpload.getFiles().getFile(0).getFileName
    mySmartUpload.getFiles().getFile
    (0).fileToField(rs,"ATTACHMENT");
    System.out.println("I am before
    update Row()");
    // Update
    file://rs.insertRow();
    file://rs.first();
    rs.updateRow();
    count++;
    } catch(Exception e) {
    out.println("An error occurs : "
    + e.toString());
    // Display the number of files uploaded
    out.println(count + " file(s) uploaded in the
    database.");
    rs.close();
    stmt.close();
    con.close();
    null

    You could try using an Excel VB script to do it. I'm considering doing the same thing. We receive reports from vendors in Excel spreadsheet formats currently. The users are now forced to save the document as a CSV file and then call up an Oracle Forms page and enter the CSV filename. I use the utility TEXT_IO to read the file in its comma delimited form. For me, this process is highly dependant on the user correctly saving the file. This causes me to perform very specific data format checking in my PL scripts. To alleviate this, I'm considering using the VB script as I mentioned. I haven't investigated it, its just an idea. Of course it'll be dependent on whether I can connect to the Oracle DB within the VB script in Excel.
    Good luck.
    Ed.

  • I just bought lightroom 5. I had lightroom 3. Now when I export my photos from lightroom 5 and upload them into my photoshop elements program to edit the photo files are at 100% zoom percentage. When I upload photos from my old lightroom 3 program they co

    I just bought lightroom 5. I had lightroom 3. Now when I export my photos from lightroom 5 and upload them into my photoshop elements program to edit the photo files are at 100% zoom percentage. When I upload photos from my old lightroom 3 program they come into photoshop at 14% zoom percentage which is what I want them to come in at so I can zoom them in to detail the skin. What might have changed settings wise between the 2 programs, I cannot figure it out.

    I just bought lightroom 5. I had lightroom 3. Now when I export my photos from lightroom 5 and upload them into my photoshop elements program to edit the photo files are at 100% zoom percentage. When I upload photos from my old lightroom 3 program they come into photoshop at 14% zoom percentage which is what I want them to come in at so I can zoom them in to detail the skin. What might have changed settings wise between the 2 programs, I cannot figure it out.

  • How can we upload file into to OCS Content repository when we are in Apex

    We have installed the Oracle Application Express 2.2.1 into the OCS 10.1.2 database.
    The Apex authentication is set to operate with OCS SSO.
    We have made a form. There is a browse button on the form. We would like if the uploaded file appeared in the OCS content database repository as
    opposed to Apex document repository.
    To put it into another word, how can we upload the file into to OCS Content repository when we are in Apex.
    Generally speaking, how can we reach content from Apex?
    We have found many java based examples to use content sdk, but how can we use them with Apex? We believe that
    content hasn't got plsql interface.
    i would highly appreciate it if you sent me a full example program.

    Hi Ram,
    Thanks for the reply
    We have a requirement to device a solution to upload the policy documents related to iProcurement
    I am planning to create an OA page to upload the content and planning to use the AOL function security to restrict the users those who can access this page .
    Is there any better way to implement the security?
    Is this approach feasible or is there any better way to approach this requirement?
    Thanks

  • Uploading Files into DB with php

    Hi There,
    I am struggling with my php code.  I added an upload button into my site, here the consultants can add documents which they have worked on.  But...I cannot get these documents into a folder in the DB, nor can I get these documents to be viewed by a Teamleader with the original request number attached.
    I used the normal script to do the Browse function:
    <form enctype="multipart/form-data" action="post3.php" method="POST">
      <input type="hidden" name="MAX_FILE_SIZE" value="300000" />
      <span class="grey">Choose a file to upload</span>:
    <input name="uploadedfile" type="file" />
    <input type="submit" value="Upload File" align="middle" />
    </form>
    But my PHP code does not want to work nor does it want to display anything...(a bit frustrating)
    can anyone please assist me with code or some pointers please..
    Thank you in advance..

    05/08/17 11:22:31 java.io.IOException: java.io.IOException: sqlldr: not found
    Does the client m/c have sqlldr installed (it will need Oracle client installation)? Does it have the ORACLE_HOME/bin directory in whatever path is appropriate for the client OS?
    Cheers, APC

  • Can I upload FOLDERS into iCloud or only individual files?

    can I upload FOLDERS into iCloud or only individual files?

    The only items you can upload are iWork documents, and these are not stored in folders. General file/folder storage is not provided.

Maybe you are looking for

  • Adobe Photoshop Express Organizer - help manual needed

    Please excuse me if I'm posting this request to the wrong forum, but I'm looking for a tutorial on how to use the online Adobe Photoshop Express Organizer, which I access through photoshop.com.   I can't locate a tutorial or instructions on it anywhe

  • My background graphic dissapears after linking in IE 7!

    Just gotta love that IE! NOT! Sorry, just a little venting there. For some reason my background graphic disappears from my navigation list items after that page has been visited. This is only happening in IE. I am using IE 7. Could be happening in ot

  • I just started doing illustrator tutorials. please help me with feedback :)

    Hey guys, i just started doing tutorials and i need your feedback to improve. i would like to know what you think of my first video. I would really appreciate it How To Save Artwork In Adobe Illustrator - YouTube

  • Database Restore using RMAN

    Can I restore a oracle database with a different name using RMAN. Say, I backup a database named orcl. Now I wanted to restore this database with a different name. Is this possible? If yes, can some one guide me through the appropriate document? Than

  • Ipad 2 backup from pc

    I did a update to IOS5 on my girlfriends IPad 2. After it was done I found out that she had not synchronzed for a very long time. All images and albums was gone. I found the backup at her PC, windows Vista, how can I use the data to restore the pictu