CL01Tcode uploading classes

Hi guys,
I am uploading Classes using Tcode CL01,
My problem is one Class has number of charecteristics means multiple charecteristics... and one Charecteristic has multiple Values.....
when i am uploading only one record is creating it doesn't going to another one means multiple records...
Here iam sending my code... check where i am doing woring...plz help me about this any quires plz replay me...
report ZCLASS_CHAR1
       no standard page heading line-size 255.
*include bdcrecx1.
Data: begin of it_upload occurs 0,
      CLASS like RMCLM-CLASS,
      klart like RMCLM-KLART,
      KLBEZ like RMCLM-KLBEZ,
      MERKMA like RMCLM-MERKMA,
      ATBEZ like CABNT-ATBEZ,
     FORMAT like RCTMV-FORMAT,
      ANZST like CABN-ANZST,
      ATWRT like CAWN-ATWRT,
      ATWTB like CAWNT-ATWTB,
      end of it_upload.
Data: begin of it_header occurs 0,
      CLASS like RMCLM-CLASS,
      klart like RMCLM-KLART,
      KLBEZ like RMCLM-KLBEZ,
      IND(2) TYPE N,
      end of it_header.
Data: begin of it_item1 occurs 0,
      MERKMA like RMCLM-MERKMA,
      ATBEZ like CABNT-ATBEZ,
     FORMAT like RCTMV-FORMAT,
      ANZST like CABN-ANZST,
      IND1(2) TYPE N,
      end of it_item1.
Data: begin of it_item2 occurs 0,
      ATWRT like CAWN-ATWRT,
      ATWTB like CAWNT-ATWTB,
      IND2(2) TYPE N,
      end of it_item2.
data: begin of it_upload_err occurs 0,
      CLASS like RMCLM-CLASS,
      klart like RMCLM-KLART,
      KLBEZ like RMCLM-KLBEZ,
      MERKMA like RMCLM-MERKMA,
      ATBEZ like CABNT-ATBEZ,
     FORMAT like RCTMV-FORMAT,
      ANZST like CABN-ANZST,
      ATWRT like CAWN-ATWRT,
      ATWTB like CAWNT-ATWTB,
      end of it_upload_err.
DATA : it_data(100) OCCURS 0 WITH HEADER LINE,
       it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
       it_field(100) OCCURS 0 WITH HEADER LINE,
       it_bdcmsg LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA : v_path TYPE string.
FIELD-SYMBOLS : <fs> TYPE ANY.
Selection Screen                                                     *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE.
PARAMETERS : p_path LIKE  rlgrap-filename  OBLIGATORY
                     DEFAULT 'D:\Documents and Settings\277512\Desktop\.txt'.
*PARAMETERS p_sel TYPE zmode DEFAULT 'A'.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b1.
At Selection Screen                                                  *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
      field_name    = ' '
    IMPORTING
      file_name     = p_path.
Start of Selection                                                   *
START-OF-SELECTION.
  v_path = p_path.
  PERFORM upload_internal_table.
  Perform process_data.
  PERFORM fill_bdcdata.
*&      Form  upload_internal_table
      text
-->  p1        text
<--  p2        text
FORM upload_internal_table .
UPLOADING THE FILE.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename = v_path
    TABLES
      data_tab = it_data.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  PERFORM format_file_read.
ENDFORM.                    " upload_internal_table
*&      Form  format_file_read
      text
-->  p1        text
<--  p2        text
FORM format_file_read .
  LOOP AT it_data.
    SPLIT it_data AT cl_abap_char_utilities=>horizontal_tab INTO
           TABLE it_field.
    LOOP AT it_field.
      IF NOT it_field IS INITIAL.
        ASSIGN COMPONENT sy-tabix OF STRUCTURE it_upload TO <fs>.
        <fs> = it_field.
      ENDIF.
    ENDLOOP.
    APPEND it_upload.
    CLEAR:  it_field ,it_upload .
    REFRESH : it_field.
  ENDLOOP.
ENDFORM.                    " format_file_read
*&      Form  process_data
      text
-->  p1        text
<--  p2        text
FORM process_data .
  Loop at it_upload.
    If it_upload is not initial.
      MOVE-CORRESPONDING it_upload TO it_header.
      ADD 1 TO it_header-ind.
      APPEND it_header.
    Endif.
    READ TABLE it_header INDEX it_header-ind.
    If sy-subrc = 0.
      MOVE-CORRESPONDING it_upload TO it_item1.
      ADD 1 TO it_item1-ind1.
      APPEND it_item1.
    Endif.
    READ TABLE it_item1 INDEX it_item1-ind1.
    If sy-subrc = 0.
      MOVE-CORRESPONDING it_upload TO it_item2.
      ADD 1 TO it_item2-ind2.
      APPEND it_item2.
    Endif.
  Endloop.
ENDFORM.                    " process_data
*&      Form  fill_bdcdata
      text
-->  p1        text
<--  p2        text
FORM fill_bdcdata .
  loop at it_header.
    refresh it_bdcdata.
*perform open_group.
    perform bdc_dynpro      using 'SAPLCLMO' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMCLM-KLART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMCLM-CLASS'
                                  it_header-class. " 'CL_kM'.
    perform bdc_field       using 'RMCLM-KLART'
                                    it_header-KLART.        " '017'.
    perform bdc_dynpro      using 'SAPLCLMO' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMCLM-CLASS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMCLM-CLASS'
                                  it_header-class. " 'CL_KM'.
    perform bdc_field       using 'RMCLM-KLART'
                                  it_header-klart.          " '017'.
    perform bdc_dynpro      using 'SAPLCLMO' '7777'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MERK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMCLM-KLBEZ'.
    perform bdc_field       using 'RMCLM-KLBEZ'
                                   it_header-KLBEZ. " 'kmmclass'.
    perform bdc_field       using 'RMCLM-STATU'
                                  '1'.
    perform bdc_field       using 'RMCLM-VONDT'
                                  '20.09.2007'.
    perform bdc_field       using 'RMCLM-BISDT'
                                  '31.12.9999'.
    perform bdc_field       using 'RMCLM-PRAUS'
                                  'X'.
    loop at it_item1 where ind1 = it_header-ind.
      add 1 to it_item1-ind1.
      perform bdc_dynpro      using 'SAPLCLMO' '7777'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RMCLM-MERKMA(01)'.
      perform bdc_field       using 'RMCLM-MERKMA(01)'
                                     it_item1-MERKMA. " 'ch_kmm'.
      perform bdc_dynpro      using 'SAPLSPO1' '0100'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=YES'.
      perform bdc_dynpro      using 'SAPLCTMV' '0110'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FORMAT'.
      perform bdc_field       using 'CABNT-ATBEZ'
                                    it_item1-ATBEZ. " 'charkmm'.
      perform bdc_field       using 'CABN-ATMST'
                                    '1'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RCTMV-FORMAT'.
      perform bdc_field       using 'RCTMV-FORMAT'
                                    'CHAR'.
      perform bdc_field       using 'RCTMV-ATEIN'
                                    'X'.
      perform bdc_dynpro      using 'SAPLCTMV' '0110'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'CABNT-ATBEZ'
                                    it_item1-ATBEZ. " 'charkmm'.
      perform bdc_field       using 'CABN-ATMST'
                                    '1'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CABN-ANZST'.
      perform bdc_field       using 'RCTMV-FORMAT'
                                    'CHAR'.
      perform bdc_field       using 'RCTMV-ATEIN'
                                    'X'.
      perform bdc_field       using 'CABN-ANZST'
                                    it_item1-anzst.         " '5'.
      perform bdc_dynpro      using 'SAPLCTMV' '0110'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'CABNT-ATBEZ'
                                    it_item1-ATBEZ. " 'charkmm'.
      perform bdc_field       using 'CABN-ATMST'
                                    '1'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CABN-ANZST'.
      perform bdc_field       using 'RCTMV-FORMAT'
                                    'CHAR'.
      perform bdc_field       using 'RCTMV-ATEIN'
                                    'X'.
      perform bdc_field       using 'CABN-ANZST'
                                     it_item1-anzst.        " '5'.
      perform bdc_dynpro      using 'SAPLCTMV' '0110'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SICH'.
      perform bdc_field       using 'CABNT-ATBEZ'
                                     it_item1-ATBEZ. " 'charkmm'.
      perform bdc_field       using 'CABN-ATMST'
                                    '1'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CABN-ANZST'.
      perform bdc_field       using 'RCTMV-FORMAT'
                                    'CHAR'.
      perform bdc_field       using 'RCTMV-ATEIN'
                                    'X'.
      perform bdc_field       using 'CABN-ANZST'
                                    '5'.
      loop at it_item2 where ind2 = it_ITEM1-ind1.
        add 1 to it_item2-ind2.
        perform bdc_dynpro      using 'SAPLCTMV' '0200'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'CAWNT-ATWTB(01)'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=SICH'.
        perform bdc_field       using 'CAWNT-ATWTB(01)'
                                      'ckdes'.
        perform bdc_field       using 'CAWN-ATWRT(01)'
                                      'ck'.
      endloop.
    endloop.
   perform bdc_transaction using 'CL01'.
   perform close_group.
        CALL TRANSACTION 'CL01' USING it_bdcdata  MODE 'A' MESSAGES INTO it_bdcmsg.
     p_sel MESSAGES INTO it_bdcmsg.
    IF sy-subrc <> 0.
      MOVE-CORRESPONDING it_UPLOAD TO it_upload_err.
      APPEND it_upload_err.
      WRITE :/ 'Data is not uploaded for the CLASS         :', it_upload-CLASS.
    ENDIF.
   ENDIF.
  ENDLOOP.
  IF it_upload_err[] IS NOT INITIAL.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        filename = ' '
        filetype = 'DAT'
      TABLES
        data_tab = it_upload_err.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ELSE.
    WRITE :/ 'Data is uploaded sucessfully for all materials.'.
  ENDIF.
ENDFORM.                    " fill_bdcdata
       Start new screen                                              *
FORM bdc_dynpro USING program dynpro.
  CLEAR it_bdcdata.
  it_bdcdata-program  = program.
  it_bdcdata-dynpro   = dynpro.
  it_bdcdata-dynbegin = 'X'.
  APPEND it_bdcdata.
ENDFORM.                    "BDC_DYNPRO
       Insert field                                                  *
FORM bdc_field USING fnam fval.
  IF fval <> space.
    CLEAR it_bdcdata.
    it_bdcdata-fnam = fnam.
    it_bdcdata-fval = fval.
   IF it_bdcdata-fval = 'D'.
     CLEAR it_bdcdata-fval.
   ENDIF.
    APPEND it_bdcdata.
  ENDIF.
ENDFORM.                    "BDC_FIELD

Plz guys help me on this... till now i didn't get any replay....

Similar Messages

  • Problems uploading class files to web server

    Regular class files upload fine(to yahoo geocities) but when I try to upload multiple class files of the same instance(ex: MyProg.class, MyProg1$.class, MyProg1$2.class) the ones with the $ symbols wont upload therefore rendering my applet on my website useless. I can change the name and then upload it, but when I go to rename it within the site, I get an "invalid file name" error. I just want my applets to run on my web page so that people can play with them.
    Any help would be greatly appreciated!
    Scott Miller

    AOL is the same. Note that the xxx$.class files relate to inner classes and you can solve your problem by removing them and creating seperate classes for these.

  • Class data upload through LSMW using BAPI

    Hi All,
    Plz tell me how to upload class data through LSMW using BAPI.I also need some study material on BAPI.
    Bye,
    Mithilesh Tiwari

    its not possible with single file
    for this you need to pass two files of data
    1 ) Header data ZSOURCE_LIST_HEADER       Source List Header
         MATNR                          C(018)    Material Number
                                        Selection Parameter for "Import/
         WERKS                          C(004)    Plant
    2) item data     ZSOURCE_LIST_ITEM         Source List Item
             MATNR                          C(018)    Material Number
             LIFNR                          C(010)    Vendor Number
             EKORG                          C(004)    Purchasing Organiz
             WERKS                          C(004)    Plant
             VDATU                          C(008)    Valid From
             BDATU                          C(008)    Valid to
    for this use below LSMW IDOC method
    Message Type         SRCLST                      Source List
    Basic Type           SRCLST01                    Source List

  • BAPI to upload customer class characteristics(XD02)

    Hi,
    My requirement is to upload Class Characteristics and its values for a customer in XD02.
    XD02- > Extras -> Classification
    I have founded a few bapi's but its not working. I tried the below options.
    BAPI_CLASS_CREATE
    BAPI_OBJCL_CREATE
    If someone who worked on similar requirement ... Pls reply.
    Thanks
    Hari

    BAPI_OBJCL_CREATE must work fou you
    look at:
    [BAPI BAPI_OBJCL_CREATE|BAPI BAPI_OBJCL_CREATE]
    [Characteristics value not assigned by BAPI_OBJCL_CHANGE;
    don't forget  BAPI_TRANSACTION_COMMIT after this FM

  • Download/upload a class created in se24

    hi friends,
    i have created a class in se24, now can i download that class in a local file, also i want 2 send it to my friend the class i have created, so can he be able to upload that file,if yes how?

    Hi Amit,
    You can import Class in your program but cant download & upload Class.
    Same is applicable to BADIs.
    To import Class in your program, goto SE24 & click FILE => IMPORT
    Best regards,
    Prashant

  • Uploading a file using jsp and com.oreilly.servlet lib package

    Sorry to bother you but I need your help folks
    I am developing an application to pick up files from a database and sent to a specified location on a different system.
    I am presently trying to run this code,I have placed this lib package from oreilly which is supposed to encapsulate the usage of file uploads,which is a jar file called cos.jar into C:\Program Files\Java\jdk1.5.0_03\jre\lib\ext folder .I have a jsp page that calls the bean which does the upload and implement the classes in the oreilly package.I am using tomcat 5
    [b]the jsp page that acts as the user interface
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Please Choose The File</title>
    </head>
    <body bgcolor="#ffffff">
    <table border="0"><tr>
    <form action="Upload.jsp" method="post"
    enctype="multipart/form-data">
    <td valign="top"><strong>Please choose your document:</strong><br></td>
    <td> <input type="file" name="file1">
    <br><br>
    </td></tr>
    <tr><td><input type="submit" value="Upload File"></td></tr>
    </form>
    </table>
    </body>
    </html>
    this is the jsp page that calls the bean
    <jsp:useBean id="uploader" class="com.UploadBean" />
    <jsp:setProperty name="uploader" property="dir" value="<%=application.getInitParameter(\"save-dir\")%>" />
    <jsp:setProperty name="uploader" property= "req" value="${pageContext.request}" />
    <html>
    <head><title>file uploads</title></head>
    <body>
    <h2>Here is information about the uploaded files</h2>
    <jsp:getProperty name="uploader" property="uploadedFiles" />
    </body>
    </html>
    [b]this is the bean class
    package com;
    import java.util.Enumeration;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.ServletRequest;
    import com.oreilly.servlet.MultipartRequest;
    import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
    import javax.servlet.*;
    public class UploadBean {
    private String webTempPath;
    private HttpServletRequest req;
    private String dir;
    // private ServletRequest request;
    public UploadBean( ) {}
    public void setDir(String dirName) {
    if (dirName == null || dirName.equals(""))
    throw new IllegalArgumentException("invalid value passed to " + getClass( ).getName( )+".setDir");
    //webTempPath = dirName;
    dir = dirName;
    /* public String getDir()
    return webTempPath;
    public void setReq(ServletRequest request) {
    if (request != null && request instanceof HttpServletRequest)
    req = (HttpServletRequest) request;
    } else {
    throw new IllegalArgumentException("Invalid value passed to " + getClass( ).getName( )+".setReq");
    public String getUploadedFiles( ) throws java.io.IOException{
    //file limit size of 5 MB
    MultipartRequest mpr = new MultipartRequest(req,dir,5 * 1024 * 1024,new DefaultFileRenamePolicy( ));
    Enumeration enume = mpr.getFileNames( );
    StringBuffer buff = new StringBuffer("");
    for (int i = 1; enume.hasMoreElements( );i++){
    buff.append("The name of uploaded file ").append(i).append(" is: ").append(mpr.getFilesystemName((String)enume.nextElement( ))).append("<br><br>");
    }//for
    //return the String
    return buff.toString( );
    } // getUploadedFiles
    On running the code I find this error messages
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: javax/servlet/ServletRequest
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:73)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NoClassDefFoundError: javax/servlet/ServletRequest
         com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
         com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:151)
         com.UploadBean.getUploadedFiles(UploadBean.java:49)
         org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:63)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
    Apache Tomcat/5.5.9
    tanks

    Hi,
    Looks like you are missing a file from the classpath. Make sure servlet.jar is available in your classpath. Ordinarily files in <tomcat_home>/lib directory should be added automatically. You need to check why it hasn't been added in your case. A good place to start would be the bat files in the bin directory viz startup.bat, catalina.bat etc.
    cheers,
    vidyut

  • How to validate the contents of excel file after uploading it.

    hi Experts,
                     we have a requirement in which we need to create business transactions with the data in the excel file after it was uploaded. we are creating this transactions(BP,LEAD..) in webui -marketing professional role-external lists. what i have to do is, after uploading the data from excel file, i need to check for the mandatory fields in the data ,if anything is missing then i need to display the error message to the user. i am new to this webclinet frame work. please help me in achieving this functioanlity.any code snippet would be very helpful.
    THANKS IN ADVANCE.

    Hi ,
    Try with the below code.
    in the upload class  ihn attributes declare
    go_messages 
    level  static   
    visibility public
    Associated Type CL_CRM_GENIL_GLOBAL_MESS_CONT.
    in the event for upload
      lo_core     = cl_crm_bol_core=>get_instance( ).
      go_messages  = lo_core->get_global_message_cont( ).
      go_messages->reset( ).
      REFRESH : t_return.
    create a function module to validate the mandatory fields.
    loop at i_table
    call a function module
    endloop.
    In function module validate the mandatory fields if empty fill a error message and append to internal table.
    loop at t_return INTO st_return WITH KEY type = 'E'.
    CALL METHOD go_messages->add_message
            EXPORTING
              iv_msg_type          = st_return-type
              iv_msg_id              = st_return-id
              iv_msg_number     = st_return-number
              iv_msg_v1             = st_return-message_v1
              iv_msg_v2             = st_return-message_v2
              iv_msg_v3             = st_return-message_v3
              iv_msg_v4            = st_return-message_v4
              iv_show_only_once = abap_true.
    endloop.
    Regards,
    Gangadhar.S

  • LSMW Standard object for class

    hi,
    I am trying to upload class data through LSMW standard object,0140,
    but while specifying file step it is giving error , No logical path has been specified.
    how to solve this problem.
    Regards

    I repeatedly do this with LSMW by recording method. (recording done once and using repeatedly)
    The recorded template is
    EQUNR  KLART  CLASS_01  STDCL_01
    If it is the case of Functional Location TPLNR in place of EQUNR.
    May try this way.
    Regards
    Jogeswara Rao

  • Images become corrupted after uploading

    Hello i'm trying to make an upload bean that uploads files form client PCs to the server, i'm using jdk 1.4 and tomcat 4.0.
    i made a modification to "Budi Kurniawan" code from "http://www.onjava.com/pub/a/onjava/2001/04/05/upload.html"
    and the package is working very well only with text files.
    when i tried to upload images or exe . i found the files corrupted. i compaired the original files with the uploaded one and they was the same in size.
    i think the problem is with the way i process the content type of the file.
    please if u have any ideas to modify this code to enable it to upload images and exe please post ur reply.
    the package name is "michael.web.upload" this package should be able to handle a form with mulitble input types and mulitble files to upload at one time
    the package contain two classes "FileUpload" provides some info about the uploaded file and "MultiPartParser" the parser that do the upload
    File Upload Class
    package michael.web.upload;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author Michael Ageeb
    * @version 1.0
    public class FileUpload {
      public static final int SAVE_NAME = 0;
      public static final int PARAM_NAME = 1;
      public static final int FILE_NAME = 2;
      public static final int ERROR_FREE = 3;
      public static final int ERROR_IO = 4;
      public static final int ERROR_MAXSIZE = 5;
      private String fileName, savePath, paramName, saveName, MIMEType;
      private long size, maxSize;
      private int saveNameMethod, errorCode;
      private Throwable th;
      public FileUpload(String paramName, String savePath) {
        size = 0;
        maxSize = Long.MAX_VALUE;
        this.paramName = paramName;
        this.savePath = savePath;
        saveName = null;
        fileName = null;
        saveNameMethod = FILE_NAME;
        errorCode = ERROR_FREE;
        th = null;
        this.MIMEType = "text/plain";
      void setMIMEType(String mime) {
        this.MIMEType = mime;
      public String getMIMEType() {
        return this.MIMEType;
      void setThrowable(Throwable th) {
        this.th = th;
      public Throwable getThrowable() {
        return this.th;
      public void setSaveNameMethod(int sn) {
        if (sn < 0 || sn > 2)return;
        saveNameMethod = sn;
      public int getSaveNameMethod() {
        return this.saveNameMethod;
      void setErrorCode(int ec) {
        if (ec < 3 || ec > 5)return;
        this.errorCode = ec;
      public int getErrorCode() {
        return errorCode;
      public String getFileName() {
        return fileName;
      public long getMaxSize() {
        return maxSize;
      public void setMaxSize(long maxSize) {
        if (maxSize < 0)return;
        this.maxSize = maxSize;
      public long getSize() {
        return size;
      public void setSavePath(String savePath) {
        this.savePath = savePath;
      public String getSavePath() {
        return savePath;
      public String getSaveName() {
        switch (this.saveNameMethod) {
          case FILE_NAME:
            return this.fileName;
          case PARAM_NAME:
            return this.paramName;
          case SAVE_NAME:
            return this.saveName != null ? this.saveName : this.fileName;
        return null;
      public void setSaveName(String saveName) {
        this.saveName = saveName;
      public String getParamName() {
        return paramName;
      void setFileName(String fileName) {
        this.fileName = fileName;
      void setSize(long size){
        this.size=size;
    }MultiPartParser Class
    package michael.web.upload;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author Michael Ageeb
    * @version 1.0
    public class MultiPartParser {
      private Hashtable fields;
      private Hashtable files;
      private String defSavePath;
      private LinkedList parameters;
      public MultiPartParser(String savePath) {
        this.defSavePath = savePath;
        parameters = new LinkedList();
        fields = new Hashtable();
        files = new Hashtable();
      public void addFileUpload(FileUpload fu) {
        files.put(fu.getParamName(), fu);
      public FileUpload getFileUpload(String param) {
        return (FileUpload) files.get(param);
      public Enumeration getFilesNames() {
        return files.keys();
      public Enumeration getFieldsNames() {
        return fields.keys();
      public Enumeration getPatameterNames() {
        return Collections.enumeration(parameters);
      boolean addParameter(String param) {
        if (parameters.contains(param))return false;
        parameters.addLast(param);
        return true;
      public String getField(String param) {
        ArrayList arr = (ArrayList) fields.get(param);
        if (arr == null)return null;
        return (String) arr.get(0);
      public String[] getFieldValues(String param) {
        ArrayList arr = (ArrayList) fields.get(param);
        if (arr == null)return null;
        String a[] = new String[arr.size()];
        for (int i = 0; i < a.length; i++) a[i] = (String) arr.get(i);
        return a;
      private String getFilename(String s) {
        int pos = s.indexOf("filename=\"");
        String filepath = s.substring(pos + 10, s.length() - 1);
        // Windows browsers include the full path on the client
        // But Linux/Unix and Mac browsers only send the filename
        // test if this is from a Windows browser
        pos = filepath.lastIndexOf("\\");
        if (pos != -1)
          return filepath.substring(pos + 1);
        else
          return filepath;
      private String getContentType(String s) {
        int pos = s.indexOf(": ");
        return s.substring(pos + 2, s.length());
      public void parse(HttpServletRequest request) throws IOException {
        ServletInputStream in = request.getInputStream();
        byte[] line = new byte[128];
        int i = in.readLine(line, 0, 128);
        if (i < 3)
          return;
        int boundaryLength = i - 2;
        String boundary = new String(line, 0, boundaryLength); //-2 discards the newline character
        while (i != -1) {
          String newLine = new String(line, 0, i);
          if (newLine.startsWith("Content-Disposition: form-data; name=\"")) {
            if (newLine.indexOf("filename=\"") != -1) {
              int pos = newLine.indexOf("name=\"");
              String paramName = newLine.substring(pos + 6,
                                                   newLine.indexOf("name=\"",
                  pos + 6));
              FileUpload fu;
              if (files.contains(paramName)) fu = (FileUpload) files.get(paramName);
              else {
                fu = new FileUpload(paramName, defSavePath);
                files.put(paramName, fu);
              addParameter(paramName);
              fu.setFileName(getFilename(new String(line, 0, i - 2)));
              //this is the file content
              i = in.readLine(line, 0, 128);
              fu.setMIMEType(getContentType(new String(line, 0, i - 2)));
              i = in.readLine(line, 0, 128);
              // blank line
              i = in.readLine(line, 0, 128);
              newLine = new String(line, 0, i);
              ByteArrayOutputStream pw = new ByteArrayOutputStream();
              //          FileOutputStream pw=new FileOutputStream((fu.getSavePath() == null ? "" : fu.getSavePath()) +
              //                       fu.getSaveName());
              long count = 0;
              while (i != -1 && !newLine.startsWith(boundary) &&
                     count <= fu.getMaxSize()) {
                // the problem is the last line of the file content
                // contains the new line character.
                // So, we need to check if the current line is
                // the last line.
                i = in.readLine(line, 0, 128);
                if ( (i == boundaryLength + 2 || i == boundaryLength + 4) // + 4 is eof
                    && (new String(line, 0, i).startsWith(boundary))) {
                  pw.write(newLine.getBytes(), 0, newLine.length() - 2);
                  count += newLine.length() - 2;
                else {
                  pw.write(newLine.getBytes(), 0, newLine.length());
                  count += newLine.length();
                newLine = new String(line, 0, i);
              pw.close();
              RandomAccessFile rf = new RandomAccessFile( (fu.getSavePath() == null ?
                  "" : fu.getSavePath()) + fu.getSaveName(), "rw");
              byte[] bytes = pw.toByteArray();
              rf.write(bytes, 0, bytes.length);
              rf.close();
              if (count > fu.getMaxSize()) {
                File f = new File( (fu.getSavePath() == null ? "" : fu.getSavePath()) +
                                  fu.getSaveName());
                f.delete();
                fu.setErrorCode(FileUpload.ERROR_MAXSIZE);
              else {
                fu.setSize(count);
            else {
              //this is a field
              // get the field name
              int pos = newLine.indexOf("name=\"");
              String fieldName = newLine.substring(pos + 6, newLine.length() - 3);
              //System.out.println("fieldName:" + fieldName);
              // blank line
              i = in.readLine(line, 0, 128);
              i = in.readLine(line, 0, 128);
              newLine = new String(line, 0, i);
              StringBuffer fieldValue = new StringBuffer(128);
              while (i != -1 && !newLine.startsWith(boundary)) {
                // The last line of the field
                // contains the new line character.
                // So, we need to check if the current line is
                // the last line.
                i = in.readLine(line, 0, 128);
                if ( (i == boundaryLength + 2 || i == boundaryLength + 4) // + 4 is eof
                    && (new String(line, 0, i).startsWith(boundary)))
                  fieldValue.append(newLine.substring(0, newLine.length() - 2));
                else
                  fieldValue.append(newLine);
                newLine = new String(line, 0, i);
              //System.out.println("fieldValue:" + fieldValue.toString());
              if (addParameter(fieldName)) {
                ArrayList arr = new ArrayList();
                arr.add(fieldValue.toString());
                fields.put(fieldName, arr);
              else {
                ( (ArrayList) fields.get(fieldName)).add(fieldValue.toString());
          i = in.readLine(line, 0, 128);
        } // end while
    }All what you want to do in ur jsp page and u will find the files in ur C:/
    <%@ page import="michael.web.upload.*" %>
    <%
    MultiPartParser parser=new MultiPartParser("C:/");
    parser.parse(request);
    %>

    Hellooooooooooo,
    Could anybody post a code that is able to upload images. (i mean raw code without using fancy controlos)

  • Free web hosting, no advertising in my URL, and FTP Upload. Too much to ask?

    IS this America or not?

    Hi
    try .........
    www.mycgiserver.com
    Good for Php and JSP - Servlets
    also isavvix (but you can't upload class files, good java community info)
    and webappcabaret.com (may be of a time limit, and you have ads thrown in with your pages).

  • File Upload Component

    I can not find a function in the Upload class that will allow me to access the browse button
    child component nor can I see any mention of the file upload component in the
    master stylesheet of the defaulttheme jar.
    what am i missing here guys?

    Dear Manjunath Jayaram,
    You don't think it is a problem that one can not access the child of a
    composite component ???
    I am sorry if you don't appreciate the problem but I can not state it any more plainly.
    "I can not find a function in the Upload class that will allow me to access the browse button
    child component nor can I see any mention of the file upload component in the
    master stylesheet of the defaulttheme jar".

  • Cannot find embedded third-party .class in my own signed .cab

    Hello,
    This is complicated.
    I'm building an applet that operates a piece of hardware on a PC (think Win32-only.) A third-party provider (henceforth referred to as TPP) provides software drivers that will be installed on client machines.
    ORIGINALLY the TPP provided a <client>.dll and a C/C++ SDK. To make the project work, I followed the article http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html.
    I built <homegrown>.DLL using JNI, made a signed <homegrown>.cab, and the applet works just great on IE. However, I have to ditch the entire thing (see below.)
    Now the TPP is providing a Java SDK in a <client>.JAR. The SDK interfaces with a <client_jni>.dll.
    I can expect that the client machine will have <client>.dll and <client_jni>.dll installed in the \winnt\system32 (or whichever %SYSTEMROOT% directory.)
    So, I ditched the <homegrown>.dll, and built a new .cab. Now, to build the .cab, I took the contents of <client>.jar and dumped them into the same directory structure as the one I use to build <homegrown>.cab. Note that <client>.jar is not signed.
    So in other words, if you look at the exception below, I, in fact, do have a directory structure that contains: "com/IridianTech/PIDresult.class" and "com/panasonic/authenticam/LoginApplet.class"
    When I run the applet, it asks me if I want to run the signed applet. I click Yes. The Java Console responds with the following:
    Error loading class: com.IridianTech.PIDresult
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: com.IridianTech.PIDresult
         at com/ms/vm/loader/URLClassLoader.loadClass (URLClassLoader.java)
         at java/lang/ClassLoader.loadClassInternal (ClassLoader.java)
         at com/panasonic/authenticam/PIDInterface.<init> (PIDInterface.java:12)
         at com/panasonic/authenticam/LoginApplet.init (LoginApplet.java:52)
         at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
         at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.run (AppletPanel.java)
         at java/lang/Thread.run (Thread.java)
    I have looked at the contents of <homegrown>.cab with WinZip, and I can see PIDresult.class in the right place.
    HOW I AM TESTING: I have IBM Websphere running directly on my PC.
    TWO QUESTIONS:
    1. Do I need to sign the applet anymore, just to use a pre-installed client_jni.dll? (Probably)
    2. WHAT DO I DO??

    This is some code i'm using:
    <applet code="upload.class" archive="upload.jar" codebase="." width="500" height="200">
    <!--<param name="codebase" value="."> -->
    <param name="cabbase" value="upload.cab">
    <param name="button_text" value="Upload via HTTP">
    <param name="file_varname" value="filename_value"><!-- where is this for? -->
    <param name="upload_url" value="http://10.2.1.133/upload/recieve.php">
    </applet>

  • Antivirus scan implementation for WebCenter Space/UCM upload document

    Hi all,
    I am trying to find some information how to implement the anti-virus scanning engine in integrated Oracle Content Manager (UCM) in WebCenter Spaces. More specifically, when a user uploading a document in the Document Manager portlet by clicking Upload button, the document is scanned by an anti-virus engine on the server before it saves to the document repository. This functionality can be found in most of the online email services such up Yahoo and Google Mail.
    Has anyone in this forum done/investigated such anti-virus scan function?
    I know this will need to dig into the Upload "event", to hookup the scanning engine. Does anyone know what jar/war file with the "upload" class or javascript controlling the Upload button?
    Thanks in advance.
    Johnny
    Edited by: johnny.zhang on Jun 9, 2010 7:49 AM

    To be honest, i don't think this is something you can do in webcenter itself.
    UCM has a quiet good system for hooking into the default behaviour based upon events and so. I believe your answer is their.
    Perhaps you can ask this question in the ECM forum below because i think it's more an content server thing than a webcenter thing.
    Also, be noticed that you should check the licence of UCM if you are planning in hooking into the events of UCM. THe default licence you get with the webcenter services for UCM is a limited one were you can only use it for webcenter. I don't know if you are allowed to use other components beside the default one installed.

  • Authorization group class maintenance

    Hi experts,
    I have a question for restricting the maintainance of classes and material classification.
    I am uploading classes in SAP and these classes the user should not be able to maintain or create material assignments to them, only the user who is executing the programm should be allowed to do it.
    How can I achieve this?
    I am using the BAPI BAPI_CLASS_CREATE  and I am filling the classbasicdata-fields authmaintain and authclassify with 999.
    What assignments to roles or to user profiles do I need to do to restrict the maintenance access to my classes?
    Many thanks for your help,
    Christoph

    Hi Shekar,
    thanks for the response.
    I took a look in transaction su21 and the authorization objects are C_KLAH_BKP and C_KLAH_BKL.
    Thats fine, but what can I do in this transaction (sorry for my basic knowledge, but i have no idea how it works).
    In the documentation to the field BGRKL of table KLAH (where the classes are stored) it says:
    "This authorization must be defined in the user master record. The authorization object is BGRKL."
    So my question is, how can I define this authorization in the user master record (for the specific value 999).
    Thanks

  • Upload / email form

    hello everyone. i made an upload files page with a browse
    button and text fields for the client to put their information in.
    how can i make the "submit" button upload the file to my server AND
    send me the email at the same time?? the uploading part works but
    not the email part. please help! thanks!!

    I am using html for the form and php for the actual uploading
    to work. Here is the form I created:
    <form enctype="multipart/form-data" action="uploader.php"
    method="POST">
    <span class="style1">
    <input type="hidden" name="MAX_FILE_SIZE"
    value="100000000" />
    <input type="hidden" name="redirect"
    value="greeny_blu/index.html" />
    </span>
    <table width="565" height="364">
    <tr>
    <td colspan="2"><div align="center"
    class="style9">
    <div align="left">Upload Files</div>
    </div></td>
    </tr>
    <tr>
    <td colspan="2"><div align="center"
    class="style10">
    <p align="left">Fill out the form below in order to
    send us your print-ready files.<br />
    Please make sure to zip or compress your files and do not
    send any <br />
    files larger than 15mb.</p>
    <p align="left">Thank you for choosing Level
    Graphics!</p>
    </div></td>
    </tr>
    <tr>
    <td width="148"><label for="companyname">
    <div align="right" class="style20">Company
    Name:</div>
    </label></td>
    <td width="405"><label
    for="companyname"></label>
    <input type="text" name="companyname" id="companyname"
    /></td>
    </tr>
    <tr>
    <td><div align="right" class="style20">Contact
    Name:</div></td>
    <td><label for="contactname"></label>
    <input type="text" name="contactname" id="contactname"
    /></td>
    </tr>
    <tr>
    <td><div align="right" class="style20">E-mail
    Address:</div></td>
    <td><label for="email"></label>
    <input type="text" name="email" id="email"
    /></td>
    </tr>
    <tr>
    <td><div align="right" class="style20">Telephone
    Number:</div></td>
    <td><label for="phonenumber"></label>
    <input type="text" name="phonenumber" id="phonenumber"
    /></td>
    </tr>
    <tr>
    <td><label for="message">
    <div align="right"
    class="style20">Message:</div>
    </label></td>
    <td><label for="message"></label>
    <textarea name="message" id="message" cols="45"
    rows="5"></textarea></td>
    </tr>
    <tr>
    <td height="41"><div align="right"><span
    class="style20">
    <label>
    <label for="upload" class="style10">
    Upload Files:</span></div>
    <div align="center"></div>
    </label></td>
    <td><label for="upload"></label>
    <input name="uploadedfile" type="file" /></td>
    </tr>
    <tr>
    <td colspan="2"><label>
    <div align="center">
    <p align="left" class="style19">When uploading files,
    do not click the &quot;Upload File&quot; button more than
    once.<br />
    Please be patient, larger files may take a while to
    send.</p>
    <p align="left" class="style19">
    <input type="submit" name="submit" id="submit"
    value="Upload File" />
    </p>
    </div>
    </label></td>
    </tr>
    </table>
    <p class="style1"> </p>
    <span class="style10">By sending us your file you have
    agreed to our <a href="terms.html">Terms &amp; Conditions
    </a></span>
    <p class="style10"> </p>
    </FORM>
    I copied the php code from an online tutorial. Here it is:
    // Where the file is going to be placed
    $target_path = "uploads/";
    /* Add the original filename to our target path.
    Result is "uploads/filename.extension" */
    $target_path = $target_path . basename(
    $_FILES['uploadedfile']['name']);
    $_FILES['uploadedfile']['tmp_name'];
    $target_path = "uploads/";
    $target_path = $target_path . basename(
    $_FILES['uploadedfile']['name']);
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
    $target_path)) {
    echo "The file ". basename(
    $_FILES['uploadedfile']['name']).
    " has been uploaded";
    } else{
    echo "There was an error uploading the file, please try
    again!";
    If you want to view to actual site then go to
    www.levelgraphics.biz/greeny_blu/upload_files
    Thank you!!!

Maybe you are looking for

  • IPhone 6 with AT&T Contract - Unexpected Charges

    I was surprised to find that my new iPhone 6 came with an unexpected feature -- an extra $25/month on my contract. Has anyone else come across this? Now I'm wondering if we were talking to a new employee at Apple or something, because I can't believe

  • Camera raw nikon d7100

    ik heb sinds kort een nikon d7100 maar deze werkt niet meer met mn camera raw door (NEF bestand van nikon) van elements ik heb van alles geprobeert en overal gezocht maar vind geen oplossing, is er eventueel een manier om camera raw op te starten zon

  • MacBook Pro 3,1 Hard Drive Upgrade

    I want to put the largest 7200 rpm drive I can in this notebook. Any suggestions? Of course reliability, should be considered also.

  • Can I install 10.5.1

    I have powerbook with 10.4.11 can I install 10.5.1 or .2?

  • OIM 11g R2 - Viewing Proxy attached to an user

    Hi, We have a requirement to set proxy to end users.But as per my knowledge ,the only way to  see/verify the proxy is by logging into OIM identity console as the end user and click on  My Information --> Proxy page. The problem here is we dont allow