How to upload a file into specified location

Hi Frndz..
How to upload a file using File upload feature in web dynpro into our specified location(usr/sap/Images/....),not into  workspace r default path in server.
Thanks in Advance
Regards
Rajesh

Hi Rajesh,
Use below code on your "Upload" Action:
     try
// Give full path of folder on server where you want to upload the file.
          File file = new File("D:\\usr\\sap\\Images\\"+wdContext.currentContextElement().getResource().getResourceName().toString());
// D:\usr\sap\Images folder should present on server
          FileOutputStream op = new FileOutputStream(file);
          if(wdContext.currentContextElement().getResource()!=null)
               text=wdContext.currentContextElement().getResource().read(false);
                    while((temp=text.read())!=-1)
                         op.write(temp);
          op.flush();
          op.close();
     catch(Exception e)
          wdComponentAPI.getMessageManager().reportSuccess("Error while uploading file : "+e.getMessage());
Thanks
Sandy

Similar Messages

  • How to change music in uc320?how to upload mp3 file into uc320?

    Dear all,
    how to change music in uc320?only one music in uc320?
    how to upload mp3 file into uc320?
    Thanks
    John

    I am evaluating the UC320 for a phone system replacement for our 100 locations.
    Allowing us to add an MP3 file to replace the current one would be a HUGE cost savings.
    This will help us cut cost when compared to the old system.
    Currently we are spending $180 on an external mp3 player for an mp3 that’s 3MB in size.
    If this system works out we are then going to recommend it to our 1800 franchisees.

  • How to upload a file into a db blob column from adf page

    How to upload a file into a db blob column from adf page
    Which option to use ?

    The forum search would be my first try...
    Then google...
    This has been asked at least once a week and got correct answers...
    Timo

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • How to upload a file into file system on server?

    We want to allow our partners to upload .csv file on our unix box. How do we upload a file into file system. I might be wrong but after reading the documentation, I think OA framework only allows to save the file in database. Please advise.
    Thanks,

    Hi,
    I was making a very silly mistake and found it. We need to create a new Entity object before you try to fill it with data. So what we can do is in the Controler, call a method in the AM that creates a new entity object (this should be made in processRequest, so that the VO gets initialized when the page loads).
    Now you can fill the entity with data in the page (ie browse and choose the file), and then when the page is submitted call a method AM again but now in processFormRequest to do the commit.
    code example
    In the AM class
    * Creates a new createCVRecord. To be Called from ProcessRequest when the page loads.
    public void createCVRecord()
    XxPersonCVVOImpl vo = getXxPersonCVVO1();
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    // Required per OA Framework Model Coding Standard M69
    row.setNewRowState(Row.STATUS_INITIALIZED);
    } // end createCVRecord()
    * The commit method. To be Called from ProcessFormRequest when the page is submitted.
    public void apply()
    getTransaction().commit();
    or else there is a different way... please refer the following thread for more details....
    File Upload
    thanks to martin, who pointed out the mistake.

  • How to upload multiple files into a server location at a single time

    Hi All,
    In my application i need to send multiple files from a particular page into the server location. In this page there will be an option to upload a file and after selecting the file , we will have an option asking if we were interested to send another file. It works just similar to google mail where we can multiple files at the same time. Right now though i had coded the uploading files concept i am facing some problems when trying to upload multiple files. All the files are being appended to a single file but i want them to be placed as different files at the specified location. Plz help me in this regard...
    Thanks in advance................,,

    Hi,
    i am sending the code in my prg. Have a look at it.
    var multi_selector = new MultiSelector( document.getElementById( 'files_list' ),3);
    In the above line i am specyfying that the maximum no. of files to be uploaded is 3. So if i upload less than 3 files, the program doesn't work and is not reading the uploaded files. If i upload 3 files it works fine. So please suggest me how to make this work irrespective of the no. of files uploaded using apache commons.
    My code is as follows:
    <form action="./servlet/Sample" method = "post" enctype="multipart/form-data">
         <!-- The file element -- NOTE: it has an ID -->
         <input id="my_file_element" type="file" name="file_1" >
         <input type="submit" name="submit1" value="submit">
    </form>
    Files:
    <!-- This is where the output will appear -->
    <div id="files_list"></div>
    <script>
         <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
         var multi_selector = new MultiSelector( document.getElementById( 'files_list' ),3);
         <!-- Pass in the file element -->
         multi_selector.addElement( document.getElementById( 'my_file_element' ) );
    </script>

  • How can upload doc file into database !!

    Dear Everyone,
    How can i upload a doc file into Mysql database ....
    can any one please give ur suggestions...
    i will show u my code
    upload.jsp
    <form name="uploader" action="uploaded.jsp"
    enctype="multipart/form-data">
      <div align="center">
      <table id="table1" border="1" bordercolor="#ff0000"
    cellpadding="0" cellspacing="0" width="50%">
        <tbody bgcolor="#c8d8f8">
          <tr>
            <td bgcolor="#ccccff">
            <p align="center">
               Resume Upload! </p>
            </td>
          </tr>
          <tr>
            <td> 
            <p align="center">You can upload your
    resume.. </p>
            <p align="center">
            <table align="center" border="1"
    cellpadding="10" cellspacing="10">
              <tbody>
                <tr>
                  <td>
                  <p><input name="file" type="file">
                  <input name="uploadButton" value="Upload"
    type="submit"></p>
                  </td>
                </tr>
              </tbody>
            </table>
            </p>
            </td>
          </tr>
        </tbody>
      </table>
      </div>
    </form>
    uploaded.jsp
    <BODY>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.io.*" %>
    <% 
        String file1=request.getParameter("file");
        int len;
        String query;
        PreparedStatement pstmt;
       int i=0;
        Class.forName("com.mysql.jdbc.Driver");
    DriverManager.getConnection("jdbc:mysql://localhost:3306    Connection conn= /employee","root","");
         try {
                File file = new File(file1);
                   if (file==null)
    %>
    <center>Nothing in It</center>
    <%
                else
                FileInputStream fis = new FileInputStream(file);
                len = (int)file.length();
                query = ("insert into loader(resume) VALUES(?)");
                pstmt = conn.prepareStatement(query);
                pstmt.setString(1,file.getName());
                pstmt.setInt(2, len);
                //method to insert a stream of bytes
                pstmt.setBinaryStream(3, fis, len);
              i=pstmt.executeUpdate();
                   if(pstmt!=null)
                 pstmt.close();
                if(conn!=null)
                 conn.close();
            } catch (Exception e) {
                e.printStackTrace();
                 if(i>0)
                        out.println("uploaded");
                    else
                        out.println("not uploaded")
    %>
    </BODY>

    File file = new File("myDoc.doc");
    FileInputStream fis = new FileInputStream(file);The file name will most likely NOT be hard-coded. I don't think the question surrounding this topic is how to do the insert statement (he/she clearly knows SQL).
    HTTP and the web browser take care of the file transfer, but the server stores the file in a temporary location. The question is, "How do I found out that location?" In PHP (I know that doesn't offer much help to you, but ...), that location is held in a variable called $_FILES. From there you can simply copy the file to a location you specify (probably with a user-specified name under a directory specifically for that user).
    I hope this is of some help:
    http://www.oop-reserch.com/mime_example_4.html
    Good Luck,
    C. R.

  • How to upload music files into iTunes, iCloud

    How do I upload music & other files (like photos) into iTunes, iCloud & iphone 4S?  I restored my phone yesterday & had to upgrade to iTunes 11.0.2 from 10, as prompted by the system.  Pls help as I am a novice in iphones & family

    You cannot upload music files from your iPhone, but you could sign up for iTunes Match and use it to match your existing music with iTunes so that you can download it right from your device. See more information for Apple's iTunes Match: https://www.apple.com/itunes/itunes-match/

  • How to upload XML file into the internal table in Webdynpro  ABAP ?

    Hi Friends,
    I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
    Regards
    Dinesh

    Hi Dinesh,
    Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
    Regards,
    Uday
    REPORT  ZUDAY_XML no standard page heading.
    " Internal table to store the XML file in binary mode
    data: begin of it_xml occurs 1,
            c(255) type x,
          end of it_xml,
    " Name-value pairs table rturned by FM SMUM_XML_PARSE
          it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
    " Table returned by FM SMUM_XML_PARSE for error handling
          it_bapiret2 type bapiret2 occurs 0 with header line.
    " XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
    data: I_xstring type xstring, 
    " String variable to hold XML file path to pass to GUI_UPLOAD
          I_file_path type string,
    " Variable to store the size of the uploaded binary XML file
          I_LENGTH TYPE I VALUE 0.
    parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
    " Get the XML file path from the user
    at selection-screen on value-request for P_path.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          FILE_NAME = P_PATH.

  • How to upload a file on SFTP location in java?

    Hi,
    I have csv file and I need to upload it on some SFTP location, can anybody please help me out?
    I have searched out but din't get such library for SFTP, please help me out.

    Is this a colleague of yours?
    Write a file to SFTP Server

  • How to upload a file to different location using CS Template

    Hi,I have a Data Entry Template with a "File" field and when I upload a document it uploads in the same directory where the Content Item is created. Is there any way to upload the document to some other directory in the Content Server. Say I have a Html folder and there is a template which has a 'file' field. After Saving the content item the uploaded file gets saved in the same folder (Html) in content server, I would like to upload the document in a different folder called "Docs" and the content item in Html folder.Is it possible? If yes then can you please guide me.Thanks,Yaju

    Hi Rajesh,
    Use below code on your "Upload" Action:
         try
    // Give full path of folder on server where you want to upload the file.
              File file = new File("D:\\usr\\sap\\Images\\"+wdContext.currentContextElement().getResource().getResourceName().toString());
    // D:\usr\sap\Images folder should present on server
              FileOutputStream op = new FileOutputStream(file);
              if(wdContext.currentContextElement().getResource()!=null)
                   text=wdContext.currentContextElement().getResource().read(false);
                        while((temp=text.read())!=-1)
                             op.write(temp);
              op.flush();
              op.close();
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportSuccess("Error while uploading file : "+e.getMessage());
    Thanks
    Sandy

  • How to Upload the files into the SiteAssets Library by SharePoint Hosted App Model

    I want to upload the Jquery and supported files in to the Site Assest library by SharePoint Hosted Apps,
    I have created a SharePoint Hosted App, added the files in the Modules
    <Module Name="ZoneTabsFiles" Url="SiteAssets">
    <File Path="ZoneTabsFiles\jquery-1.11.2.min.js" Url="jquery-1.11.2.min.js" ReplaceContent="TRUE" />
    <File Path="ZoneTabsFiles\jquery-ui.css" Url="jquery-ui.css" ReplaceContent="TRUE" />
    <File Path="ZoneTabsFiles\jquery-ui.min.js" Url="jquery-ui.min.js" ReplaceContent="TRUE" />
    <File Path="ZoneTabsFiles\ZoneTabs.js" Url="ZoneTabs.js" ReplaceContent="TRUE" />
    </Module>
    The Apps is successfully getting activated but the files are not visible,
    Similarly I want to upload the .webpart file to webpart catalogs.
    <Module Name="ZoneTabsWebpart" List="113" Url="_catalogs/wp" Path="lists\wplib" RootWebOnly="TRUE">
    <File Url="ZoneTabs.webpart" ReplaceContent="TRUE" />
    </Module>
    The Functionality I can achieve Provider Hosted app, but Can it be done by SharePoint Hosted apps,
    Currently the app has the permission of Full Control on Site and Web 
    Thanks in advance

    Hello Ashok,
    you can use JSOM to provision the webpart files in SharePoint hosted app.
    Please see the below article for more details.
    http://www.sharepointnutsandbolts.com/2013/05/sp2013-host-web-apps-provisioning-files.html
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • How to upload/download file into/from blob column in ADF/JDev 11g.

    Hello to all.
    I found demo from Kuba user on that page: http://kuba.zilp.pl/?id=1
    But that demo is for release 10g and too complicated for me for this time (I'm fish in Jdeveloper).
    I can create some simple table view (of form view) with oracle connection with table with blob data.
    Blob column will content doc/xls/pdf ...etc.
    Now I can add two buttons for download and upload.
    What I have to do in next time?
    Is it possible to use some component or something?
    Thank you
    Ben

    I was able to accomplish downloading from a blob, but I'm trying to dynamically set the ContentType.
    As the table may contain different types of files, I'm setting the ContentType to #{row.Fileext}, where Fileext is set in SQL select as follows:
    pseudocode: get file extension, and set the content type based on file extension.
    sql select :decode(substr(fdv.file_name,instr(fdv.file_name,'.',-1,1)+1),'log','text/plain; charset=utf-8','xml','text/xml','xls','application/vnd.ms-excel','tif','image/tiff','jpg','image/jpeg','unknown')
    I rather use a fuction/method, and tried the following instead:
    ContentType = #{backingBeanScope.backing_processReqs.FileAttachContType}
    where FileAttachContType =
    public class ProcessReqs {
    public String FileAttachContType() {
    // code to substring filename for extension and decode values
    return strContType
    But I get the following error:
    Error 500--Internal Server Error
              javax.el.PropertyNotFoundException: The class 'sunrider.reqpoportal.view.backing.ProcessReqs' does not have the property 'FileAttachContType'.
                   at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547)
                   at javax.el.BeanELResolver.getValue(BeanELResolver.java:249)
                   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    Ideas?
    PS: Kuba, I've been trying to get to your blog all day, and it would just time out.
    Thanks everyone in advance!
    -R
    Edited by: user6631964 on Jul 24, 2009 5:55 PM

  • How do I upload XML files into sap table?

    Dear all,
    I found some methods that upload xml into SAP,
    but there doesn’t work under 4.6c.
    Can someone tell me how to upload XML files into
    sap under 4.6c?
    THX!

    hi,
    You can convert XML to abap using transformations. Simple transformations is a proprietary SAP programming language that describes the transformation of ABAP data to XML (serialization) and from XML to ABAP data (deserialization).
    goto SE80->workbench->edit object(or other objects)->in object selection chose more tab and then choose the transformation radio button and write a name and click create new.
    Here you enter your transformation like
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/sapxsl"
    >
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:transform>
    You can use this transfomation in your program using call transformation. You can find more info on call transformation in help.
    Hope this helps.
    Regards,
    Richa

  • How to upload CSV file(Flat File) in SAP system.

    Hi All,
    Please guide me how to upload flat file into SAP system.
    Regards
    Avinav

    Use following syntax -
    DATA L_P_FILE TYPE STRING.
         L_P_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = L_P_FILE   <-------Your PC file name
        FILETYPE                      = u2018ASCu2019
        HAS_FIELD_SEPARATOR           = u2018Xu2019
      TABLES
        DATA_TAB                      = P_I_DATA[]   <-----Your internal table
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    Endif

Maybe you are looking for

  • Bridge CS4 one Windows 7 stops working when trying to load pictures in a new file

    Bridge starts fine but when i click on some files to see the pictures in there it stops working. The message i get is: "Adobe Bridge has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify

  • Transport order between company codes

    Hi, I have the following question: We are setting up the system where transport orders are being used between two company codes. Is it possible when transport orders are being used and stock is available in the supplying company to not accept the tra

  • Help!  Where Did My Printing Options Go With My Epson R800?

    For some reason, I've lost the Format Settings from my Epson R800 printer (USB) when I open Page Setup. Typically you should get options for "Manual", "Roll Paper-Borderless Banner" and several others in Page Setup. This all started when I did a "Res

  • Counter Output with NI cDAQ 9188

    I am trying to generate pulses with the counters included in the NI 9188 cDAQ chassis. I tried first to do that with NI 9411 module but this task didn't figure out in MAX. I'm trying now to perform that with the PFI 0 BNC connexion in the chassis but

  • How to define percent for MRP?

    Dear experts! I have a project: ABC WBS1: Floor1 Network 1: System 1: Activity 1: Shopping 1 Material 1: 100 PC. WBS1: Floor2 Network 2: System 2: Activity 2: Shopping 2 Material 1: 20 PC. For first procure stage i only buy 40% material for this proj