Code for  File upload / down load from WD java application

Hi experts ,
I am creating a WD java application , I want to add Picture upload and piucture download ( from / To ) KM . I also want to specify the path ( where it has to be uploaded in KM ) and picture name . can i get any code so that i can use it in WD application .
Regards
Abhay

First you need to make sure your web dynpro application has permissions to access the file in the first place, but you could use the standard java.io.File class:
File file = new File("/path/file.sh");
file.setExecutable(false);
file.setReadable(false);
file.setWritable(false);

Similar Messages

  • Javabean for file up-/down-load to/from the database

    Dear all,
    Has anyone any experience in client-side customizing/extending
    through the use of standard JavaBeans or
    Pluggable Java Components (PJCs) within the Oracle (Web-)Forms
    Developer 6i environment? We want to realize the
    following:
    By using a Java Bean within a (Web-)Forms 6i client that is
    capable of file uploads to and file downloads from a database
    (end tier).
    Important requirement is to uploads/downloads files (BLOB, CLOB)
    directly to/from the database, NOT TO/FROM THE FILESYSTEM.
    We have found a sample JavaBean on
    http://otn.oracle.com/sample_code/products/forms/content.html.
    Unfortunately, this code is based on file transfering to/from
    the filesystem.
    Is there someone who did customizations enabling file
    uploads/downloads into/from the database? Are there any
    other suggestions?
    Please contact:
    Deep Nanda
    Developer
    Wolters Kluwer Academic Publishers
    The Netherlands
    email: [email protected]
    Thanks in advance,
    Deep

    I've not tried this out but in theory since a Java Bean is just
    a piece of Java code you could do this using JDBC. However,
    while you may have a valid reason for this, it really defeats
    the purpose of having a middle tier. The idea behind the web
    deployment is that the bulk of the application is on a powerful
    server which makes the client as light weight as possible. If
    you add more functionality to the client (which is not UI
    specific) then you will increase the download to the client, you
    will impact the system requirements for the client and you will
    probably make the application less scalable (think about if yu
    have 1000 clients with database connections for the middle tier
    and now all 1000 want to connect from the client as well - yuo
    double the access of the database)
    SO the short answer is Yes yuo can in theory - in practice I
    would be very careful in deciding to move this way.
    Regards
    Grant Ronald
    Forms Product Management

  • HI Masters , I need information for file upload program in web dynpro java

    Hi masters,
           i need some inforamtion and documentation on file upload program in web dynpro java

    Hi surya,
    You can follow this procedure to upload the file
    i) Take One Context Attribute named as "D1" of Type "binary".
    ii) Take one FileUpload UI Element in the Layout Tab.
    iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".
    iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.
    v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.
    File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")
    ff.mkdir();
    try
    byte b[]=null;
    IWDAttributeInfo objAttinfo=null;
    IWDModifiableBinaryType binType=null;
    File f=null;
    FileOutputStream fos=null;
    if(wdContext.currentContextElement().getD1()!=null)
    b=wdContext.currentContextElement().getD1();
    objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);
    binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();
    f=new File(ff.getName()+"
    "+binType.getFileName());
    fos=new FileOutputStream(f);
    fos.write(b);
    fos.flush();
    fos.close();
    objMessageManager.reportSuccess("File uploaded to server");
    } catch (Exception e)
    objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);
    return;
    The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0
    You can access your Uploaded file from the following Path
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ
    Regards
    Sagar Ingalwar

  • Please give me some code for file upload. I am working in websphere

    Hi,
    I have made the form with encript = multipart. with four text field to enter some information about the file. now i want to upload a file f1.txt in the folder project.com.dos.files. And also I want to make appear the file and the four information regarding that file in a another jsp page as grids.
    Please help how to do that. I am using Websphere Studio Application Developer. Please help with some code

    Check out the fileupload package in the apache commons project

  • Execute Batch Files, DOS Commands etc. from my Java Application

    Can someone show me how it works?
    I dont need any return values, just execute a Batch File or a Command
    Thx, Guardian

    Hi Luke,
    Just wanna add 2 things to what you've written. (your sample code)
    Point 1pro.waitFor(); should be called before attempting the read anything from the process' InputStream if you don't want to lose anything your process might print out. When Runtime.getRuntime.exec("your_command") is executed, the resulting process is just another runaway thread unless you tell you calling thread to wait for this process to end before proceeding further. This is where waitFor() comes in.
    Point 2Runtime.getRuntime().exec("C:\\command.com /C mybat.bat"); works but it is pretty platform dependent. If you need to write platform independent stuff, you could just drop the command.com stuff and go right to the batch file or the command you need to execute. I've managed to just survive with Runtime.getRuntime().exec("mybat.bat");Regards,
    Noel

  • How to upload an attachment from webdynpro java application.

    Hi,
    Please assist me to create a View in WEBDYNPRO JAVA, which speaks about how to upload an attachment and save it in SAP
    Regards,
    Suri

    Well , first of all, I think you should search the SDN with keyword such as "upload files ".
    Here is the link of an article about upload and download files in WD.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9076a593-2b08-2d10-2890-9a7078246ec4
    Hope that can help you.
    Regards
    Carfield

  • HT1391 I have down loaded a number of songs but after a short while they go messing. I tunes can not find them. If I down load from a cd there is no problems. I tunes can always find them. For that reason I no longer down load from the I tunes store. why

    iTunes can not find the music that was down loaded form the iTunes store. Why? Where is it locateded? They are there and play for a short while then they disappear. Why? What is happening to the songs that I have down loaded????? Anything that I import form a cd is still there!
    Why can't iTunes find what I down loaded from the iTune store???????
    If Heaven
    3:31
    Andy Griggs
    This I Gotta See
    Country
    17
    In front of the "if" there is a gray circle with and "!" in the center. When I click on the song to play I get this message.The song could not be used because the original file could not be found.

    iTunes can not find the music that was down loaded form the iTunes store. Why? Where is it locateded? They are there and play for a short while then they disappear. Why? What is happening to the songs that I have down loaded????? Anything that I import form a cd is still there!
    Why can't iTunes find what I down loaded from the iTune store???????
    If Heaven
    3:31
    Andy Griggs
    This I Gotta See
    Country
    17
    In front of the "if" there is a gray circle with and "!" in the center. When I click on the song to play I get this message.The song could not be used because the original file could not be found.

  • I can't open pdf files I have down-loaded from Safari

    I can't open pdf files I have down-loaded from Safari (6.0 and OSX 10.8) with preview or acrobat. I get a corrupted file message. Anyone have a fix?

    From the Safari menu bar, select Safari ▹ Preferences… ▹ Security and uncheck the box labeled Enable plug-ins. Test.

  • ALBPM 6.0 : The maximum size for file uploads has been exceeded.

    Hi,
    I use AquaLogic BPM Entreprise server to deploy my Process. When I try to publish a process on my server I get the following error:
    An unexpected error ocurred.
    The error's technical description is:
    "javax.servlet.jsp.JspException: null"
    Possible causes are:
    The maximum size for file uploads has been exceeded.
    If you are trying to publish an exported project you should publish it using the remote project option.
    If you are trying to upload the participant's photo you should choose a smaller one.
    An internal error has ocurred, please contact support attaching this page's source code.
    Has someone resolve it?
    Thank's.

    Hi,
    Sure you've figured this out by now, but when you get the "Maximum size for file uploads" error during publish consider:
    1. if your export project file is over 10mb, use "Remote Project" (instead of "Exported Project") as the publication source. That way when you select the remote project, you will point to ".fpr" directory of the project you are trying to publish.
    Most times your project is not on a network drive that the server has access to. If this is the case, upload the .exp file to the machine where the Process Administrator is running, then expand it in any directory (just unzip the file). Then, from the Process Administrator, use the option to publish a Remote Project by entering the path to the .fpr directory you just created when unzipping the project.
    2. Check to see if you have cataloged any jars and marked them as non-versionable. Most of the times the project size is big just because of the external jar files. So as a best practice, when you do a project export select the option "include only-versionable jars", that will get reduce the project size considerably (usually to Kb's). Of course you have to manually copy the Jar files to your Ext folder.
    hth,
    Dan

  • This is my Jsp code for image upload in database:

    This is my Jsp code for image upload in database:
    -----------Upload.jsp----------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <form method="POST" action="UploadPicture.jsp" enctype="multiform/form-data">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.sql.Date" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%
    try
    String ct="3";
    String path;
    File image=new File(request.getParameter("upload"));
    path=request.getParameter("upload");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pstmt=con.prepareStatement("insert into graphics values(?,?,?)");
    pstmt.setString(2,path);
    pstmt.setString(3,ct);
    InputStream is=new FileInputStream(path);
    pstmt.setBinaryStream(1, is, (int)(image.length()));
    int s=pstmt.executeUpdate();
    if(s>0)
    out.println("Uploaded");
    else
    %>
    unsucessfull
    <%}
    is.close();
    pstmt.close();
    catch(Exception e)
    }%>
    </p>
    <p><br>
    <img src="UploadedPicture.jsp">image</img>
    <p></p>
    </form>
    </body>
    </html>
    My database name is itPlusElectronics and the table name is "graphics".
    I have seen as a result of the above code that the image is stored in database as "Long binary data". and database table is look like as follows-------
    picture path id
    Long binary data D:\AMRIT\1-1-Picture.jpg 3
    To retrive and display i use this JSP code as--
    ------------------------UploadedPicture.jsp------------------------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%@page import="javax.servlet.ServletOutputStream"%>
    <%
    try
    String path;
    path=request.getParameter("upload1");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pst = con.prepareStatement("SELECT * FROM graphics WHERE id ='3'");
    // pst.setString(3, id);
    ResultSet rs = pst.executeQuery();
    path=rs.getString("path");
    if(rs.next()) {
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = rs.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=path");
    while((size=sImage.read(bytearray))!= -1 )
    response.getOutputStream().write(bytearray,0,size) ;
    response.flushBuffer();
    sImage.close();
    rs.close();
    catch(Exception e)
    %>
    </body>
    </html>
    Now after browsing a jpg image file from client side and pressing submit button ;
    I am unable display the image in the Upload.jsp file.Though I use
    <img src="UploadedPicture.jsp">image</img> HTML code in Upload.jsp
    file .
    Now I am unable to find out the mistakes which is needed for displaying the picture in the Upload.jsp page..
    If any one can help with the proper jsp code to retrive and display the image ,please please help me !!!!!!!!!!!!!!!!!!!!!!!!!!

    dketcham wrote:
    cotton.m wrote:
    >
    2) I'm looking at how you called stuff, and you're trying to call the jsp file as an image? That jsp isn't the source of the image, just a page linking to an image. I think if you really want to do things that way you're going to need to just include that jsp within the jsp you're calling it from (or you can do it the easy way, and if you have the information to get the path of the image you want, you could simply call the image from the first jsp you posted)This is incorrect.
    There are two JSPs. The second when called will (if it worked) return the source of an image as stored in the database.even when called with <img src=xx.jsp>??
    Yes.
    If any of what I say next seems obvious or otherwise negative I apologize, just trying to explain and I don't know what you know vs what you don't.
    The link in the src is just a URL not a filetype. So just because it ends with JSP does not mean it has to return HTML. The content type is determined by the browser using the Content-Type header returned by the server in the HTTP response. In this case the header is set to be a jpeg so that's what the browser will attempt to interpret the content part of the response as.
    So in fact one is not limited to just HTML or images but whatever content type you would like to return (that the browser can understand anyway). This could be HTML or it could be an image of some type or it could be a PDF or it could be an Excel spreadsheet. All you have to do in the JSP is set the header appropriately and then send content that is actually in that format.
    This does not just apply to JSP by the way but all other web programming languages. You can do similar things to produce the same results in PHP, Perl, ASP etc.
    The only JSP/Servlet complication is whether or not doing this in a JSP is a "good" idea but I am not an expert enough at that to make a definitive statement. Mostly though JDBC in a JSP is a no-no.

  • Trying to get my itunes to go back to english but is coming up Russian on windows 7. I initally installed English version and about 6 months ago it came back Russian. I have use all the suggestion including unistall and reenstall a new down load from appl

    I'm trying to get my itunes to go back to english but is coming up Russian on windows 7. I initally installed English version and about 6 months ago it came back Russian. It was English for over 2 yrs. I have use all the suggestion including unistall and reenstall of a new down load from apple.

    I copied the iTunes file from the external drive and it's in both places.  I thought all I would need is the iTunes program (which I downloaded to new computer) and my iTunes library file.  There must be something else that's missing.  My iTunes library looks the same on the new computer as it does when I open it on the external drive.  If I click on an iTunes library song from my new computer, it will only play if I have the external drive plugged in.
    My back-up drive is a mess.  I have multiple copies of music, video, photo, and document files and I don't know how that happened. ={  Obviously, I don't know how to back up stuff properly and there are back-up files extending over a 6- to 8-year period.  I think all I did was just drag and drop the main folders from the back-up drive to the same main folders on the C: drive.  Also (and I'm kind of fuzzy on this) Windows used to automatically save music files in a folder within my document files (which makes no sense to me).  As my Jewish friends would say, "Oy Vey!" 

  • TS3212 every time i try to download itunes my computer comes ups up with an error code half way through  down load error code 2330

    every time i try to download itunes my computer comes ups up with an error code half way through  down load error code 2330

    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

  • What type of software do I need to down load from my mac a program from my high definition camcorder the video is 1.5 hours long

    What type of software should I buy to down load from my mac a video from my high def camcorder

    I was only able to find downloads for that camera for Windows.
    No where was I able to find anything for a Mac from Panasonic.
    Allan

  • Validator for file upload component is not working !!

    This validator method for a file upload component is throwing a java.lang.NullPointerException.
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    long size= fileUpload1.getUploadedFile().getSize();
    if (size>65535){
    throw new ValidatorException(new FacesMessage("Your image is too big!"));
    Any help to solve this problem is very much appreciated.
    Thanks.

    Hi i have a fileUpload in a pop-up and the methods are :
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    try {
    com.sun.rave.web.ui.model.UploadedFile uploadedFile = ((Upload)component).getUploadedFile();
    long l_filesize = uploadedFile.getSize();
    if ( l_filesize > 1000000)
    throw new ValidatorException(new FacesMessage("File Size should be less than 1000000 bytes! It is" + l_filesize));
    else {
    String tipo = uploadedFile.getContentType();
    if ( tipo.compareTo("application/word") == -1 )
    if ( tipo.compareTo("application/rtf") == -1 )
    if ( tipo.compareTo("application/pdf") == -1 )
    throw new ValidatorException(new FacesMessage("Error : los tipos de archivo aceptados son PDF, WORD y RTF"));
    } catch (Exception ex) {
    this.mauvaisFichier = true;
    error(ex.getMessage());
    public String botonValidar_action() {
    if ( !this.mauvaisFichier )
    if ( this.fileUpload1.getUploadedFile() != null )
    if ( this.fileUpload1.getUploadedFile().getSize() > 0 )
    try {
    this.getSessionBean1().getComunicacion().setArchivo( new javax.sql.rowset.serial.SerialBlob(this.fileUpload1.getUploadedFile().getBytes() ) );
    this.getSessionBean1().getComunicacion().setTipoArchivo( this.fileUpload1.getUploadedFile().getOriginalName().substring(this.fileUpload1.getUploadedFile().getOriginalName().length() - 3 ) );
    } catch(Exception e){
    e.getMessage();
    return null;
    I have to put a boolean value because the first time, validation code doesn't function ( the method botonValidar_action() is called ) correctly. The error message appears but empty.
    If I try next time then it's ok.
    Thx for any issue.

Maybe you are looking for

  • Strange resolution problem mac mini 2010 w lion 10.7.3

    Hi! I use XBMC as a media center client, and did the update to 10.7.3 yesterday. This update gave me a problem with the resolution on a 55 "LED TV. If xbmc is running and I switch the source on the television to for example, tuner or blueray player,

  • 2011 MacBook Pro Runs slow and Freezes

    I have a Macbook Pro 2.8 GHz Intel Core i7 running 8 GB of RAM and it runs like a dog - freezing and crashing like a PC would - have to keep rebooting it. What is going on. Has Bill Gates poisoned the Apple?

  • IPad 1 syncing error message

    For some reason, my iPad 1 stopped syncing Instapaper, so I uninstalled the app and went to reinstall and found that it still wouldn't work. So I did a clean install from a back up and now after every sync I get an error message saying (user name)> (

  • Execute a Fm in Background

    Hello experts, please have a look at the part of the code in report below       CALL FUNCTION 'ME_PRICING_ALL'       IN BACKGROUND TASK. IMPORT EKOMV TO lt_KOMV FROM MEMORY ID 'RM06K010'. loop at lt_komv.   write: / lt_komv-KWERT. endloop. in FM ('ME

  • Adding additional field (po number) in FBL5N standard report

    Hiya Gurus,                  I have got a requirement to create a custom report similiar to that of FBL5N standard report with and addition of PO number for every line item of the report and customer address at the header level.                I want