Uploading Multiple Files from web client to web server

Am using a Digitally signed applet to pickup files from a specific directory and only to pickup those of a specific type. Applet is called by a HTML converted page and uses the JAVA 1.3.1 plug-in. Client side is ok, but the server side does not work - cannot see how to drop the files down onto the web server.
code
URL url = null ;
FileInputStream filReader = null ;
DataOutputStream dosOutfile = null ;
HttpURLConnection httpUrlConn = null ;
int bytes = 0 ;
//read local file on client's hd with signed applet
try
filReader = new FileInputStream( new File( fromFile ) );
catch ( java.io.FileNotFoundException eNotFound )
DisplayStatus ( fromFile + " Not found");
eNotFound.printStackTrace();
// start setup to server-side copy of in file
try
url = new URL ( toFile ) ;
catch ( java.net.MalformedURLException eMalFormedUrl )
DisplayStatus ( url + " url mal formed");
eMalFormedUrl.printStackTrace();
// create a HttpUrl connection for POSTING
try
httpUrlConn = (HttpURLConnection) url.openConnection(); // do not remove this casting, as needed
catch ( java.io.IOException eIoException )
DisplayStatus ( url + " IO not possible");
eIoException.printStackTrace();
// set preferences
httpUrlConn.setDoInput(true); // default value, but best make sure
httpUrlConn.setDoOutput(true); // default value, but best make sure
httpUrlConn.setUseCaches(false); // enable write straight through
try
httpUrlConn.setRequestMethod("POST") ;
// httpUrlConn.setRequestMethod("PUT") ;
} catch ( java.net.ProtocolException eProtEx )
DisplayStatus ( "Protocol Exception on setting up POST") ;
eProtEx.printStackTrace();
httpUrlConn.setRequestProperty("Content-Type", "multipart/form-data");
// permissions?
try
java.security.Permission permission = httpUrlConn.getPermission() ;
if ( iDebug == true )
DisplayStatus ("Permission = " + permission.toString() ) ;
DisplayStatus ( "Actions = " + permission.getActions() ) ;
DisplayStatus ( "Name = " + permission.getName() ) ;
catch ( java.io.IOException eUrlIOConnException )
DisplayStatus ( "httpUrl " + httpUrlConn + " IO not possible");
DisplayStatus ( eUrlIOConnException.toString() ) ;
eUrlIOConnException.printStackTrace();
// connect
try
this.VerifyHttpResponseCode ( httpUrlConn.getResponseCode() ) ;
DisplayStatus ("About to connect") ;
httpUrlConn.connect() ;
DisplayStatus ("Connected") ;
if ( iDebug == true )
DisplayStatus ("Connected Content Encoding = " + httpUrlConn.getContentEncoding() ) ;
DisplayStatus ("Connected Content Length = " + httpUrlConn.getContentLength() ) ;
DisplayStatus ("Connected Content Type = " + httpUrlConn.getContentType() ) ;
DisplayStatus ("Connected default allow user interaction = " + httpUrlConn.getDefaultAllowUserInteraction() ) ;
DisplayStatus ("Connected File Map = " + httpUrlConn.getFileNameMap() ) ;
DisplayStatus ("Connected request method = " + httpUrlConn.getRequestMethod() ) ;
DisplayStatus ("Connected response code = " + httpUrlConn.getResponseCode() ) ;
DisplayStatus ("Connected response message = " + httpUrlConn.getResponseMessage() ) ;
DisplayStatus ("Connected = " + httpUrlConn.getURL() ) ;
} // end of debug print out status
catch ( java.net.ConnectException eConnEx )
this.DisplayStatus ( "Connection error - no server listening or incorrect port " ) ;
this.DisplayStatus ( "Connection error - http = " + httpUrlConn) ;
eConnEx.printStackTrace();
catch ( java.io.IOException eUrlConnException )
DisplayStatus ( "url " + url + " connection not possible");
DisplayStatus ( eUrlConnException.toString() ) ;
eUrlConnException.printStackTrace();
// create file on server
try
dosOutfile = new DataOutputStream ( new BufferedOutputStream( httpUrlConn.getOutputStream () ) ) ;
catch ( java.io.IOException eNewFileIO )
DisplayStatus ("Unable to create file on server / buffer output stream " + toFile ) ;
// copy files char by char for the moment, till testing complete
try
bytes = filReader.read();
while(bytes != -1)
dosOutfile.writeByte(bytes);
bytes = filReader.read();
// close both files
dosOutfile.flush ();
dosOutfile.close ();
filReader.close();
catch (java.io.IOException eCpyIo )
DisplayStatus ("Error copying files") ;
connection of the HttpURLConnection
gives 'Fobbiden' response for 'PUT'
and
'method not allowed' for 'POST'
trying to create the file on the server than causes IOException at the create DataStream line
What am I doing wrong?
Is this philosphy correct?
Should the HttpURLConnection be to the target folder
and then create the file in it?

hello,
first here is my interpretation of your prob.
You have a client.From this client you are trying to upload files onto a server.
Finding the files and reading them on the client side is not a prob. The prob is storing them on the server side.
right?
If the above stated prob is right, here is a solution.
1. You have to first inform the server that you are sending the file. Unless you do so the server will not understand when you have started sending the file.
So, initially, the applet which you have written need to communicate with a servlet on the server side.
This can be done using reqs.. .get or post.In the req itself you can even send the name of the folder wherein you want to store the file you are going to transfer later on.
Next, after receiving the folder name, the servlet can now understand that next file data is going to be received.
The applet now sends the file which is received by the servlet and stored appropriately.
You need to explicitly write a servlet to receive a data into the file and then store the file into appropriate folder.
for any further probs email me at [email protected]

Similar Messages

  • How to upload file from a client machine to server machine

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

  • How to store multiple files from SAp in to Application server?

    Hi Guys,
                 Can anybody tell me how to store multiple files from SAP into Application server.in my application i have to get the data from SAP tables BSEG , BKPF , BSAK and BSIK that to daily i have to do.
                Any Logic  or Code for how to do is welcomed.
                        plz help me urgently.
    Thanks,
    Gopi

    Hi,
      directories creates basis. If you have task to store data in application server you already should have information into which folder you have to do it. If you don't have this information because it is just for example training for next task then you can use your personal folder into which you have access. To get list of all available folders please look at attached code and form get_directories (you get the list of folders you see in transaction AL11). But don't forget: If you are using open dataset you have to have rights to access application folder!
    Here you are code which I use to upload text files from local disc into application folder
    Regards,
      Karol
    *& Report  FILE_PC_TO_SAP
    REPORT  FILE_PC_TO_SAP.
    DATA: BEGIN OF searchpoints OCCURS 100,
            DIRNAME(200)     TYPE c, " name of directory.
            sp_name(100)     TYPE c," name of entry. (may end with *)
          END OF searchpoints.
    DATA: BEGIN OF isearchpoints OCCURS 10,
            dirname(75) TYPE c,            " name of directory.
            aliass(75)  TYPE c,            " alias for directory.
            svrname(75) TYPE c,            " svr where directory is availabl
            sp_name(75) TYPE c,            " name of entry. (may end with *)
            sp_cs(10)   TYPE c,            " ContainsString pattern for name
          END OF isearchpoints.
    data: l_file type filetable.
    data: l_rc   type i.
    data: itab   type TABLE OF string.
    data: g_tmp_file_path type rlgrap-filename.
    data: wa_itab type string.
    data: h_destin(100) type c.
    data: dat      type string.
    INITIALIZATION.
    perform get_directories.
    START-OF-SELECTION.
    parameters: in_file type string OBLIGATORY LOWER CASE.
    parameters: destin(100) type c OBLIGATORY LOWER CASE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       FILENAME                      = in_file
       "FILETYPE                      = 'BIN'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = ' '
       HEADER_LENGTH                 = 0
       READ_BY_LINE                  = 'X'
       DAT_MODE                      = ' '
      TABLES
        DATA_TAB                     = itab
    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.
      write: / 'Error during loading input file!'.
    ENDIF.
    if h_destin is INITIAL.
      h_destin = in_file.
    endif.
    CONCATENATE destin h_destin into dat SEPARATED BY '/'.
    *TRANSLATE dat TO UPPER CASE.
    OPEN DATASET dat FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-SUBRC = 0.
      loop at itab into wa_itab.
         TRANSFER: wa_itab TO dat.
      endloop.
      CLOSE DATASET dat.
      write: / 'File uploaded!'.
    ELSE.
      write: / 'Not possible to open dataset'.
    ENDIF.
    at selection-screen on value-request for in_file.
      perform select_input_file_name.
      loop at l_file into g_tmp_file_path.
        move g_tmp_file_path to in_file.
        h_destin = ''.
        SPLIT g_tmp_file_path at '\' into table itab.
        loop at itab into g_tmp_file_path.
          h_destin = g_tmp_file_path.
        endloop.
      endloop.
    at selection-screen on value-request for destin.
      DATA: lt_dfies    TYPE TABLE OF dfies.
      DATA: lwa_dfies   TYPE dfies.
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          tabname    = '/BI0/PCO_AREA'
          lfieldname = 'CO_AREA'
        IMPORTING
          dfies_wa   = lwa_dfies.
      lwa_dfies-tabname = 'searchpoints'.
      lwa_dfies-REPTEXT   = 'Destination directory'.
      lwa_dfies-LENG      = 100.
      lwa_dfies-INTLEN    = 100.
      lwa_dfies-OUTPUTLEN = 100.
      lwa_dfies-fieldname = 'SP_NAME'.
      APPEND lwa_dfies TO lt_dfies.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD = 'SP_NAME'
          DYNPPROG = SY-REPID
          DYNPNR = SY-DYNNR
          DYNPROFIELD = 'destin'
          VALUE_ORG = 'S'
        TABLES
          VALUE_TAB = searchpoints
          FIELD_TAB = lt_dfies
        EXCEPTIONS
          PARAMETER_ERROR = 1
          NO_VALUES_FOUND = 2
          OTHERS = 3.
    *&      Form  select_input_file_name
    *       text
    form select_input_file_name.
    *  call function 'F4_FILENAME'
    *       exporting
    *            program_name  = sy-repid
    *            dynpro_number = sy-dynnr
    *            field_name    = 'PATH'
    *       importing
    *            file_name     = g_tmp_file_path.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
      WINDOW_TITLE = 'Please choose a file'
      "default_extension = '*.TXT'
      "default_filename = 'C:\*.txt'
      initial_directory = 'C:\'
      file_filter = '*.*'
      CHANGING
      FILE_TABLE = l_file
      RC = l_RC
      EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR = 2
      ERROR_NO_GUI = 3
      NOT_SUPPORTED_BY_GUI = 4
      OTHERS = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    "select_input_file_name
    *&      Form  WRITE_DB_HOME
    *       Write DB home directory
    *       no parameters
    FORM write_db_home.
      CASE sy-dbsys(3).
        WHEN 'ORA'.
          CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ORAHOME'
                             ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_ORAHOME',       30 searchpoints-dirname.
          MOVE: 'DIR_ORAHOME'        TO searchpoints-sp_name.
          APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'ADA'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'DBROOT'
                          ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_ADA_DBROOT',    30 searchpoints-dirname.
          MOVE: 'DIR_ADA_DBROOT'     TO searchpoints-sp_name.
          APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'INF'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'INFORMIXDIR'
                          ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_INF_INFORMIXDIR', 30 searchpoints-dirname.
          MOVE: 'DIR_INF_INFORMIXDIR' TO searchpoints-sp_name.
          APPEND searchpoints..
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'DB6'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'INSTHOME'
                          ID 'VALUE' FIELD searchpoints-dirname.
          IF sy-subrc = 0.
    *--- C5056155 Start of ALV -------------------------------*
    *        PERFORM flip_flop(rsora000) USING cflag.
    *        WRITE: / 'DIR_DB2_HOME',    30 searchpoints-dirname.
            MOVE: 'DIR_DB2_HOME'       TO searchpoints-sp_name.
            APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
          ELSE.
            EXIT.
          ENDIF.
        WHEN OTHERS.
          EXIT.
      ENDCASE.
    ENDFORM.                    " WRITE_DB_HOME
    FORM get_directories.
    * get the name and aliases of ALL userdefined directories
      SELECT * FROM user_dir INTO isearchpoints
        WHERE svrname = sy-uname.
        MOVE isearchpoints-dirname to searchpoints-dirname.
        MOVE isearchpoints-aliass  to searchpoints-sp_name.
        APPEND searchpoints.
      ENDSELECT.
      SELECT * FROM user_dir INTO isearchpoints
        WHERE svrname = 'all'.
        MOVE isearchpoints-dirname to searchpoints-dirname.
        MOVE isearchpoints-aliass  to searchpoints-sp_name.
        APPEND searchpoints.
      ENDSELECT.
    * Get DB home
      IF sy-dbsys(3) = 'ADA'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ATRA'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_ATRA'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_BINARY'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_BINARY'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory $DIR_CCMS
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CCMS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CCMS'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CT_LOGGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CT_LOGGING'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CT_RUN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CT_RUN'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_DATA'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_DATA'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'DB6'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_DBMS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_DBMS'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_EXECUTABLE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_EXECUTABLE'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_EXE_ROOT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_EXE_ROOT'       TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GEN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GEN'            TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GEN_ROOT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GEN_ROOT'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GLOBAL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GLOBAL'         TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GRAPH_EXE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GRAPH_EXE'      TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GRAPH_LIB'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GRAPH_LIB'      TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_HOME'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_HOME'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'INF'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_INSTALL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_INSTALL'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_INSTANCE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_INSTANCE'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_LIBRARY'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_LIBRARY'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_LOGGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_LOGGING'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the files written by the memory inspector
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_MEMORY_INSPECTOR'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_MEMORY_INSPECTOR' TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'ORA'.
        PERFORM write_db_home.
      ENDIF.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PAGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PAGING'         TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PUT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PUT'            TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PERF'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PERF'           TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PROFILE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PROFILE'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PROTOKOLLS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PROTOKOLLS'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_REORG'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_REORG'          TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ROLL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_ROLL'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_RSYN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_RSYN'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * calculate directory for saphostagent (no sapparam available...)
      IF ( sy-opsys(3) = 'WIN' ) OR ( sy-opsys(3) = 'Win' ).
        DATA: windir_path(64),  programfiles_path(64).
    *   hoping that ProgramFiles is set in service user environment
        CALL 'C_GETENV' ID 'NAME'  FIELD 'ProgramFiles'
                        ID 'VALUE' FIELD programfiles_path.
        IF programfiles_path IS INITIAL.
    *     %ProgramFiles% not available. guess from windir
          CALL 'C_GETENV' ID 'NAME'  FIELD 'windir'
                          ID 'VALUE' FIELD windir_path.
    *     e.g. S:\WINDOWS ==> S:\Program Files
          CONCATENATE windir_path(3) 'Program Files' INTO programfiles_path.
        ENDIF.
        CONCATENATE programfiles_path '\SAP\hostctrl'
                                                 INTO searchpoints-dirname.
      ELSE.
    *   on UNIX, the path is hard coded
        searchpoints-dirname = '/usr/sap/hostctrl'.
      ENDIF.
      MOVE: 'DIR_SAPHOSTAGENT' TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SAPUSERS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      IF searchpoints-dirname = '.'.
        IF sy-opsys = 'Windows NT'.
          searchpoints-dirname = '.\'.
        ELSE.
          searchpoints-dirname = './'.
        ENDIF.
      ENDIF.
      MOVE: 'DIR_SAPUSERS'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SETUPS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SETUPS'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SORTTMP'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SORTTMP'        TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SOURCE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SOURCE'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TEMP'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TEMP'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRANS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRANS'          TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRFILES'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRFILES'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRSUB'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRSUB'          TO searchpoints-sp_name.
      APPEND searchpoints.
    *  get the name of the current server.
      CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'
                         ID 'VALUE' FIELD searchpoints-dirname.
      data: h_ind type i.
      LOOP AT searchpoints.
        h_ind = sy-tabix.
        IF searchpoints-sp_name IS INITIAL.
          DELETE searchpoints INDEX h_ind.
        ENDIF.
      ENDLOOP.
    ENDFORM.

  • How to allow the user to upload a file from their desktop to MII Server?

    Hi,
    Is there a way for the user to specify a file on their local computer to upload to the MII server for processing?  We have a method that works for uploading from a shared network drive, but now the need/desire is to allow the user to upload a file from their desktop.
    Ideally, this would be a file browser that the user would click on to browse their local desktop and select the file and click "Upload" but not sure what's possible?
    This is using 12.1 SP4.
    Thanks for the help.
    Kerby

    [Uploading Documents|Uploading Documents]

  • CSOM code in C # to download and upload multiple files from/to sharepoint library

    Hi All,
    Please help me I want to first download all my files from sharepoint library to my local folder using CSOM code .
    Once downloading is completed I want to upload those files in another library .
    I have done same thing using web services but need to do by CSOM now.
    Thanks please provide code of peice
    sudhanshu sharma Do good and cast it into river :)

    By using below code I am downloading multiple documents and uploading same doc to sharepoint while uploading i want to updat emetadata of source library to destination library ..
    I am able to do so but want to do now for dateandTime+metadata column as well please can you check my approach and let me know tht how to do for such kind of columns-
    FileProperty.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    namespace ST_9569f2fe51bd4137bb31c38b3d46455d
    class FileProperty
    public string Title; //single line of text
    public string Description; //Multiple line of text
    public string DocumentType; //choice type
    public string DocumentCategory; //Choice type
    public string DocumentNumber; //Single line of text
    // public string DocumentStatus; //Choice
    public string DocumentTitle; //single line of text
    // public string CrossReference; //Multipleline type
    //public DateTime PublishDate; //DateAndTime Type column
    /// <summary>
    /// Get the SP Document Column internal name and thier respective values
    /// in key -value pair.
    /// </summary>
    /// <returns>The List of KeyValuePair</returns>
    public List<KeyValuePair<string, string>> getColumnKeyValueListProducts()
    {//Target Columns
    List<KeyValuePair<string, string>> columnKeyValuePairList = new List<KeyValuePair<string, string>>();
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Title", Title));
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Description0", Description));
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Document_x0020_Type", DocumentType));
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Document_x0020_Category", DocumentCategory));
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Document_x0020_Number", DocumentNumber));
    //columnKeyValuePairList.Add(new KeyValuePair<string, string>("Document_x0020_Status", DocumentStatus));
    columnKeyValuePairList.Add(new KeyValuePair<string, string>("Document_x0020_Title", DocumentTitle));
    //columnKeyValuePairList.Add(new KeyValuePair<string, string>("Cross%5Fx0020%5FReference", CrossReference));
    // columnKeyValuePairList.Add(new KeyValuePair<string, string>("Publish_x0020_Date", PublishDate));
    return columnKeyValuePairList;
    /* public List<KeyValuePair<string, DateTime>> getColumnKeyValueListProductsforDatenTime()
    //Target Columns
    List<KeyValuePair<string, DateTime>> columnKeyValuePairListdt = new List<KeyValuePair<string, DateTime>>();
    columnKeyValuePairListdt.Add(new KeyValuePair<string, DateTime>("Publish_x0020_Date", PublishDate));
    return columnKeyValuePairListdt;
    #region Help: Introduction to the script task
    /* The Script Task allows you to perform virtually any operation that can be accomplished in
    * a .Net application within the context of an Integration Services control flow.
    * Expand the other regions which have "Help" prefixes for examples of specific ways to use
    * Integration Services features within this script task. */
    #endregion
    #region Namespaces
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using Microsoft.SharePoint.Client;
    using System.IO;
    using System.Net;
    using System.Collections.Generic;
    //using System.IO;
    #endregion
    namespace ST_9569f2fe51bd4137bb31c38b3d46455d
    /// <summary>
    /// ScriptMain is the entry point class of the script. Do not change the name, attributes,
    /// or parent of this class.
    /// </summary>
    [Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region Help: Using Integration Services variables and parameters in a script
    /* To use a variable in this script, first ensure that the variable has been added to
    * either the list contained in the ReadOnlyVariables property or the list contained in
    * the ReadWriteVariables property of this script task, according to whether or not your
    * code needs to write to the variable. To add the variable, save this script, close this instance of
    * Visual Studio, and update the ReadOnlyVariables and
    * ReadWriteVariables properties in the Script Transformation Editor window.
    * To use a parameter in this script, follow the same steps. Parameters are always read-only.
    * Example of reading from a variable:
    * DateTime startTime = (DateTime) Dts.Variables["System::StartTime"].Value;
    * Example of writing to a variable:
    * Dts.Variables["User::myStringVariable"].Value = "new value";
    * Example of reading from a package parameter:
    * int batchId = (int) Dts.Variables["$Package::batchId"].Value;
    * Example of reading from a project parameter:
    * int batchId = (int) Dts.Variables["$Project::batchId"].Value;
    * Example of reading from a sensitive project parameter:
    * int batchId = (int) Dts.Variables["$Project::batchId"].GetSensitiveValue();
    #endregion
    #region Help: Firing Integration Services events from a script
    /* This script task can fire events for logging purposes.
    * Example of firing an error event:
    * Dts.Events.FireError(18, "Process Values", "Bad value", "", 0);
    * Example of firing an information event:
    * Dts.Events.FireInformation(3, "Process Values", "Processing has started", "", 0, ref fireAgain)
    * Example of firing a warning event:
    * Dts.Events.FireWarning(14, "Process Values", "No values received for input", "", 0);
    #endregion
    #region Help: Using Integration Services connection managers in a script
    /* Some types of connection managers can be used in this script task. See the topic
    * "Working with Connection Managers Programatically" for details.
    * Example of using an ADO.Net connection manager:
    * object rawConnection = Dts.Connections["Sales DB"].AcquireConnection(Dts.Transaction);
    * SqlConnection myADONETConnection = (SqlConnection)rawConnection;
    * //Use the connection in some code here, then release the connection
    * Dts.Connections["Sales DB"].ReleaseConnection(rawConnection);
    * Example of using a File connection manager
    * object rawConnection = Dts.Connections["Prices.zip"].AcquireConnection(Dts.Transaction);
    * string filePath = (string)rawConnection;
    * //Use the connection in some code here, then release the connection
    * Dts.Connections["Prices.zip"].ReleaseConnection(rawConnection);
    #endregion
    /// <summary>
    /// This method is called when this script task executes in the control flow.
    /// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    /// To open Help, press F1.
    /// </summary>
    public void Main()
    // TODO: Add your code here
    //Unpublished lib used to download files from sharepoint to local and Published library for uploading files from local to sharepoint
    //var srcFolderUrl = "http://ui3dats011x:2015/sites/techunits/UnPublished%20Doc/Forms/AllItems.aspx";
    //var destFolderUrl = "http://ui3dats011x:2015/sites/techunits/Published%20Documents/Forms/AllItems.aspx";
    using (var ctx = new ClientContext("http://ui3dats011x:2015/sites/techunits/"))
    try
    List LibraryName = ctx.Web.Lists.GetByTitle("Unpublished Doc");
    List LibraryName1 = ctx.Web.Lists.GetByTitle("Published Documents");
    ctx.Load(LibraryName1.RootFolder);
    ctx.Load(LibraryName);
    ctx.ExecuteQuery();
    CamlQuery camlQuery = new CamlQuery();
    //Used this caml query for filtering
    camlQuery.ViewXml = @"<View><Query><Where><Eq><FieldRef Name='Document_x0020_Type'/><Value Type='Choice'>Technical Unit</Value></Eq></Where></Query></View>";
    Microsoft.SharePoint.Client.ListItemCollection listItems = LibraryName.GetItems(camlQuery);
    ctx.Load<Microsoft.SharePoint.Client.ListItemCollection>(listItems);
    ctx.ExecuteQuery();
    string filename;
    FileInformation fileInfo;
    System.IO.FileStream outputStream;
    Dictionary<string, string> itemmetadata = new Dictionary<string, string>();
    foreach (var item in listItems)
    if (itemmetadata.Count > 0)
    itemmetadata.Clear();
    ctx.Load(item);
    ctx.ExecuteQuery();
    ctx.Load(item.File);
    ctx.ExecuteQuery();
    filename = item.File.Name;
    foreach (KeyValuePair<string, object> metaval in item.FieldValues.)
    string metavalue = Convert.ToString(metaval.Value);
    //if(String.IsNullOrEmpty(metaval.Value.ToString()))
    if (!(String.IsNullOrEmpty(metavalue)))
    itemmetadata.Add(metaval.Key, metaval.Value.ToString());
    else
    itemmetadata.Add(metaval.Key, "");
    fileInfo = Microsoft.SharePoint.Client.File.OpenBinaryDirect(ctx, item.File.ServerRelativeUrl.ToString());
    outputStream = new FileStream(@"C:\Users\jainruc\Desktop\Sudhanshu\ComDownload\" + filename, FileMode.Create, FileAccess.Write);
    fileInfo.Stream.CopyTo(outputStream);
    outputStream.Dispose();
    outputStream.Close();
    //Uploading
    string srcpath = @"C:\Users\jainruc\Desktop\Sudhanshu\ComDownload\";
    string siteName = @"http://ui3dats011x:2015/sites/techunits/";
    string docLibraryName = @"http://ui3dats011x:2015/sites/techunits/Published%20Documents/Forms/AllItems.aspx";
    UploadFile(srcpath, siteName, docLibraryName, itemmetadata,filename);
    }//End of try
    catch (Exception ex)
    Dts.TaskResult = (int)ScriptResults.Success;
    public void UploadFile(string srcpath, string siteName, string docLibraryName,Dictionary<string,string> metavalue,string filename)
    using (ClientContext ctx = new ClientContext("http://ui3dats011x:2015/sites/techunits/"))
    try
    List LibraryName1 = ctx.Web.Lists.GetByTitle("Published Documents");
    ctx.Load(LibraryName1.RootFolder);
    ctx.Load(LibraryName1);
    ctx.ExecuteQuery();
    ctx.Credentials = new NetworkCredential("jainfgfgh", "Pashg8878", "mydomain");
    //Loop for getting all files one by one
    using (var fs = new FileStream(String.Concat(srcpath,"/",filename), FileMode.OpenOrCreate))
    string fileUrl = String.Format("{0}/{1}", LibraryName1.RootFolder.ServerRelativeUrl, filename);
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, fileUrl, fs, true);
    UpdateMetadata(fileUrl,ctx,metavalue);
    //End of looping
    }//End of try block
    catch (Exception ex)
    }//End of Using
    }//End of function
    public void UpdateMetadata(string uploadedfileurl,ClientContext ctx,Dictionary<string,string> mvalue)
    Microsoft.SharePoint.Client.File uploadedfile = ctx.Web.GetFileByServerRelativeUrl(uploadedfileurl);
    //create an object of the class holding all the properties of the document
    ctx.Load(uploadedfile);
    ctx.ExecuteQuery();
    FileProperty fileProperty = new FileProperty();
    fileProperty.Description = mvalue["Description0"];
    fileProperty.Title = mvalue["Title"];
    fileProperty.DocumentType = mvalue["Document_x0020_Type"];
    fileProperty.DocumentCategory = mvalue["DocumentCategory"];
    fileProperty.DocumentNumber = mvalue["DocumentNumber"];
    fileProperty.DocumentTitle = mvalue["DocumentTitle"];
    //fileProperty.PublishDate = Convert.ToDateTime(mvalue["PublishDate"]);
    // fileProperty.DocumentStatus = mvalue["DocumentStatus"];
    List<KeyValuePair<string, string>> columnKeyValueList;
    //create a list of item need to be updated or added to sharepoint library
    List<FileProperty> propertyList = new List<FileProperty>();
    propertyList.Add(fileProperty);
    columnKeyValueList = fileProperty.getColumnKeyValueListProducts();
    ListItem item = uploadedfile.ListItemAllFields;
    foreach (KeyValuePair<string, string> metadataitem in columnKeyValueList)
    item[metadataitem.Key.ToString()] = metadataitem.Value.ToString();
    //item["Title"] = uploadedfile.Title;
    item.Update();
    ctx.Load(item);
    ctx.ExecuteQuery();
    #region ScriptResults declaration
    /// <summary>
    /// This enum provides a convenient shorthand within the scope of this class for setting the
    /// result of the script.
    /// This code was generated automatically.
    /// </summary>
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    sudhanshu sharma Do good and cast it into river :)

  • BT Cloud - how to upload multiple files from my an...

    As the title says, how do you do this.? I can only see how to upload single photos at a t ime.
    thanks
    David

    If you use the web interface you can drag-drop up to 200 files at a time.
    If you use the code installed on a PC/Mac, you can add a folder using 'add to backup', and all files and subfolders will get automatically uploaded (and thed folder structure will stay intact).  To install, log in to MyBT, choose the My BT Could button, and the next page will have a download button.
    Any future changes to files in that folder and subfolder will also get backed up: insertions, changes and deletions.  It isn't a real backup: beware with the automatic client version that when you delete files from the folder, they will be deleted from the Cloud backup.
    ~~~
    If you are mainly using it for photos, you may find the not very advertised free Flickr Pro account you can get by signing up with your BT email is more suitable.  Though I still haven't found a really convenient mass upload mechanism for Flickr either.

  • How to Upload Multiple Files from a folder at a single go?

    Hi friends,
    My requriment is to Upload many txt or excel files in a single shot.
    If its a single file i can upload through Ws_upload or Gui_upload.
    in the same way is there any function modules to upload many files at a time.
    Regards
    Venkatesh.S

    Hi Venkatesh,
    Try this code..
    data: l_filename type string OCCURS 0 WITH HEADER LINE.
    l_filename = 'c:\temp1.xls'.
    APPEND L_FILENAME
    l_filename = 'c:\temp2.xls'.
    APPEND L_FILENAME
    LOOP AT L_FILENAME
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = l_filename
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = '#'
    TABLES
    DATA_TAB = itab1.
    OPEN DATASET <applicationfilename> FOR OUTPUT IN TEXT MODE.
    IF sy-subrc = 0.
    LOOP AT ITAB1
    TRANSFER ITAB1 TO pt_infil .
    ENDLOOP.
    ENDIF.
    CLOSE DATASET pt_infil.
    ENDLOOP.
    OR
    use CL_GUI_FRONTEND_SERVICES->DIRECTORY_LIST_FILES
    Regards,
    Goutham.

  • Help: question on send XML file from java client to java server

    Hi, I am now to Java, and now I am going to set up a simple network in the lab.
    I have created a random array of data and transferred to XML file on my client. Now, I would like to send it to the server. I am wondering how I can put the XML file into my client, and do I need any parser to let the server show what random date it has received?
    Anybody can give me any idea or some basic code? Thank you.
    Now, I am referring the KnockKnock example in Java online tutorial. But, not clear how to deal with the XML File.
    Fengyuan

    There are several ways you can achieve this: one could be that you transfer data over HTTP, using Servlets for instance. Have a Servlet listening on the Server with content type 'text/xml', POST the XML data to the server and have the Servlet to receive the data and re-compose the XML file. This can be achieved with different libraries:
    1) JAXB --> this is good because is the JDK standard, also for web services
    2) Castor (http://www.castor.org/)

  • Moving .csv file from windows(client) to linux server

    Hi All,
    I have a .csv file in "D:\Datafiles\Test.csv". I need to move this file to server top "$XXLS_TOP/admin/import/US/" using shell scripting.
    Server : XYZ
    Login : test_user
    Password : password
    Can anyone help me on this.I am new to shell scripting..
    thanks

    Hi,
    As already mentioned above, you have 2 major options:
    1.samba (lots of docs on the net)
    2. ftp (even more docs on the net)
    If you decide to use ftp, then here's a starting point:
    -install ftp server on your Win machine-
    -you can use lftp , which has the ability to read a set of commands from a file
    For instance:
    [kido@kido ~]$ pwd
    /home/kido
    [kido@kido ~]$ ls
    cacti_backup.tar.gz                    Desktop     ftp       j2re-1_4_1_02-solaris-sparc.sh  out   test
    cacti_data_query_ucdnet_device_io.xml  diskio.tar  help.txt  net-snmp_devio.xml              perl
    [kido@kido ~]$ cd ftp
    [kido@kido ftp]$ ls
    ftpscript
    [kido@kido ftp]$ cat ftpscript
    open localhost -u kido,123kido$
    ls
    get help.txt
    bye
    [kido@kido ftp]$ lftp -f ftpscript
    drwxrwxrwx    2 501      501          4096 Feb 25  2009 Desktop
    -rw-r--r--    1 501      501      13137873 Mar 30 19:54 cacti_backup.tar.gz
    -rw-rw-r--    1 500      500         34216 Feb 03  2007 cacti_data_query_ucdnet_device_io.xml
    -rw-r--r--    1 501      501          4950 Apr 07 08:46 diskio.tar
    drwxrwxr-x    2 501      501          4096 Sep 08 15:53 ftp
    -rw-rw-r--    1 501      501           144 Jul 30 19:27 help.txt
    -rw-r--r--    1 501      501      23023830 May 27 14:17 j2re-1_4_1_02-solaris-sparc.sh
    -rw-rw-r--    1 500      500          2568 Aug 18  2005 net-snmp_devio.xml
    -rw-rw-r--    1 501      501          8093 Aug 05 15:21 out
    drwxrwxr-x    2 501      501          4096 Jun 16 15:38 perl
    drwxrwxr-x    2 501      501          4096 Sep 02 13:10 test
    [kido@kido ftp]$ ls
    ftpscript  help.txt
    [kido@kido ftp]$ You can modify ftpscript and put any commands you need. Then you can run "lftp -f ftpscript" from cron (for instance). For more details: man lftp.
    kido

  • Unable to upload multiple files

    In MOSS, I am unable to upload multiple files from the Site Actions | Manage Content and Structure | New | Item menu. I have tried adding Word documents and image files (JPEG, GIFS) to no avail into the \images or \document folders. Even if I try just one file, three or five, the menu never initiates or progresses. It just sits. If I cancel, the menu returns immediately. I have tried to change security settings with no success. Trying to upload multiple files on different MOSS installations also fails. If this is related to a Web Dev settings, can you tell me exactly where the setting is? Thanks for your insight. cm

    Believe it or not, I have found a solution after about 4hrs of fiddling around. This appears to be a bug in Sharepoint 2007. There is a work around that I have discovered! Follow the steps below and let me know if this works for you. It has worked for me and other people so far.
    The steps are as follows:
    1) Browse to your website at http://<servername>/_layouts/settings.aspx; you will need to login by providing a service account name & password or your site collection administrator account & password.
    2) Once you login, click on 'Site Actions' menu.
    3) Then, click on 'Manage Site Content and Structure'.
    4) Click on any document library you want to upload or add files into. If you do not see the 'Upload' menu from the dropdown main menu between the 'New' and 'Actions' menu then you have this bug as well showing up on your server. Don't give up yet, there is a solution. Keep going through these steps!
    5) Click on 'New' and select 'Item'.
    6) You should now see the Upload Document page; under the input browse field there should be a link for 'Upload Multiple Files...', if you do not see this you will need to install either Office 2003 or Office 2007. If you do see it, click on it.
    7) Now, you should see the multiple upload page that allows you to select multiple files. If you try to select one or several and click on the OK button, nothing will happen. No need to worry! There is a work around. Just keep reading to the next step.
    8) On the hierarchy navigation you will have links something like this:
    WebSiteName > Folder1 > Folder2
    9) Click on the "Document Library" folder name; in our case it was Folder1. Basically its the folder you ended up in in step #4.
    10) Now, did you notice anyting in your menu change? Now you should be able to see the Upload menu option between the 'New' and 'Actions' menu that you could not see in step #4.
    11) Click on the 'Upload' menu and select 'Upload Multiple Documents'
    12) Now, you will be back at the Upload document page where you were in step #7
    13) Select one file or many and then click OK. Now it works!!! You should get an IE popup asking you that your about to upload files to your site, Click OK.
    VOILA!!!
    Don't ask me why, I do not know why this happens but it works.

  • How to upload file from java client to php

    hi
    i am trying to upload/send a file from client using swing/applet
    and receiving it with php code.
    here is the php code which uploads the post file from the client
    $uploaddir = "/home/raghavendra/Documents/";
    $file = basename( $_FILES["uploadedfile"]["name"]);
    echo "file:\n".$file;
    $uploadfile = $uploaddir. $file;
    if (move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
    else {
    echo "File upload failure Possible file upload attack!\n";
    and corresponding different java code which post the
    1)
    public void postmethodTest(String filefrom){
    try{
    String hostname = "localhost";
    int port = 80;
    InetAddress addr = InetAddress.getByName(hostname);
    Socket socket = new Socket(addr, port);
    // Send header
    String path ="/php_prgs/var/www/nsboxng/htdocs/tryupdate.php";
    File theFile = new File(filefrom);
    System.out.println ("size: " + (int) theFile.length());
    DataInputStream fis = new DataInputStream(new BufferedInputStream(new FileInputStream(theFile)));
    byte[] theData = new byte[(int) theFile.length( )];
    fis.readFully(theData);
    fis.close();
    DataOutputStream raw = new DataOutputStream(socket.getOutputStream());
    Writer wr = new OutputStreamWriter(raw);
    String command =
    "POST "+path+" HTTP/1.0\r\n"
    + "Content-type: multipart/form-data, boundary=mango\r\n"
    + "Content-length: " + ((int) theFile.length()) + "\r\n"
    + "\r\n"
    + "--mango\r\n"
    + "content-disposition: name=\"MAX_FILE_SIZE\"\r\n"
    + "\r\n"
    + "\r\n--mango\r\n"
    + "content-disposition: attachment; name=\"datafile\"" ;
    String filename="test.doc\"\r\n"
    + "Content-Type: text/doc\r\n"
    + "Content-Transfer-Encoding: binary\r\n"
    + "\r\n";
    wr.write(command);
    wr.flush();
    raw.write(theData);
    raw.flush( );
    wr.write("\r\n--mango--\r\n");
    wr.flush( );
    BufferedReader rd = new BufferedReader(new
    InputStreamReader(socket.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    System.out.println("out"+line);
    wr.close();
    raw.close();
    socket.close();
    } catch (Exception e) {System.out.println(e.toString());}
    2)
    public void postMethod(String strURL, String filefrom){
    try {
    String fname = filefrom.substring(filefrom.lastIndexOf("/")+1, filefrom.length());
    File input=new File(filefrom);
    // Prepare HTTP post
    PostMethod post = new PostMethod(strURL);
    // Request content will be retrieved directly
    // from the input stream
    // Per default, the request content needs to be buffered
    // in order to determine its length.
    // Request body buffering can be avoided when
    // content length is explicitly specified
    post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
    // Specify content type and encoding
    // If content encoding is not explicitly specified
    // ISO-8859-1 is assumed
    //post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
    post.setRequestHeader("Content-Type","multipart/form-data");
    post.setRequestHeader("Content-Disposition", "form-data; name="+fname);
    // Get HTTP client
    HttpClient httpclient = new HttpClient();
    // Execute request
    try {
    int result=httpclient.executeMethod(post);
    // Display status code
    System.out.println("Response status code: " +result);
    // Display response
    System.out.println("Response body: ");
    // System.out.println(post.getResponseBodyAsString());
    BufferedReader console = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
    String name = null;
    String line = null;
    try {
    while ((line = console.readLine()) != null) {
    System.out.println("output"+line);
    //name = console.readLine();
    catch (IOException e) { name = "<" + e + ">"; }
    // System.out.println("Hello " + name);
    } finally {
    // Release current connection to the connection pool
    // once you are done
    post.releaseConnection();
    catch(IOException e){
    but am getting else condition response from php code
    but if i post with html code it is working fine.
    can anybody help me please where i have to change the code
    please suggest me. am in a big trouble and i have to complete this as soon as possible

    One thread is enough.
    http://forum.java.sun.com/thread.jspa?threadID=5198449
    You could have bumped it instead. Also, you still just posted a junk of unformatted stuff. Furthermore, for HttpClient support ask at an HttpClient mailing list of rorum.

  • To upload a file from client machine to server machine

    Hi everybody!
    Could anyone plz help me. I am struck in a problem
    I want to transfer a file from client's machine to server but I am not able to upload
    It is tranferring the file only to the local machine
    I am using orielley package It is transferring files only to my local machine but not to the server .Can anyone correct it. It's very urgent
    how to write the relative path for server
    I am using this path and it is not uploading
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    Here is my code:
    <%@ page import="java.util.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="com.oreilly.servlet.MultipartRequest"%>
    <%
    try {
    // Blindly take it on faith this is a multipart/form-data request
    // Construct a MultipartRequest to help read the information.
    // Pass in the request, a directory to saves files to, and the
    // maximum POST size we should attempt to handle.
    // Here we (rudely) write to the server root and impose 5 Meg limit.
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    out.println("<HTML>");
    out.println("<HEAD><TITLE>UploadTest</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<H1>UploadTest</H1>");
    // Print the parameters we received
    out.println("<H3>Params:</H3>");
    out.println("<PRE>");
    Enumeration params = multi.getParameterNames();
    while (params.hasMoreElements()) {
    String name = (String)params.nextElement();
    String value = multi.getParameter(name);
    out.println(name + " = " + value);
    out.println("</PRE>");
    // Show which files we received
    out.println("<H3>Files:</H3>");
    out.println("<PRE>");
    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements()) {
    String name = (String)files.nextElement();
    String filename = multi.getFilesystemName(name);
    String type = multi.getContentType(name);
    File f = multi.getFile(name);
    out.println("name: " + name);
    out.println("filename: " + filename);
    out.println("type: " + type);
    if (f != null) {
    out.println("length: " + f.length());
    out.println();
    out.println("</PRE>");
    catch (Exception e) {
    out.println("<PRE>");
    out.println("</PRE>");
    out.println("</BODY></HTML>");
    %>

    you have not understood my point
    how does this code will run on servlet when I want to upload a file from client's
    machine to server machine
    what I am doing is I am giving an option to the user that he/she can browse the file and then select any file and finally it's action is post in the jsp form for which I have sent the code
    All the computers are connected in LAN
    So how to upload a file from client's machine to server's machine
    Plz give me a solution

  • Upload a file in KM repository with Web dynpro for abap

    Hi gurus, i´m trying to create a KM repository and then upload a file into this repository with Web dynpro for abap , but i can´t find any info. Can anyone help me with this problem, i have to solve it ASAP...
    Thanks for all....
    Regards,
    Diego.

    Please referr to the ideas on this thread.
    Install Problems withe the NW04s ABAP Trial verssion
    You have installed the loopback adapter and made the propriate entries in the hosts file, right?
    Regards,
    Rich Heilman

  • Urgent - Upload a file from Client to Server.

    Need to load a file from the client machine to the Server running 9iAS Rel. 1 on a HP Unix Machine.
    We are using Forms 6i. We have looked into the File Upload Utility demo code provided with Forms 6i - but have been unsuccessful in reusing it. PLS HELP

    Duplicate post.
    Upload a file from client to server by forms in E-Bussiness Suite R12
    Re: Upload a file from client to server by forms in E-Bussiness Suite R12.

  • Uploading large files from applet to servlet throws out of memory error

    I have a java applet that needs to upload files from a client machine
    to a web server using a servlet. the problem i am having is that in
    the current scheme, files larger than 17-20MB throw an out of memory
    error. is there any way we can get around this problem? i will post
    the client and server side code for reference.
    Client Side Code:
    import java.io.*;
    import java.net.*;
    // this class is a client that enables transfer of files from client
    // to server. This client connects to a servlet running on the server
    // and transmits the file.
    public class fileTransferClient
    private static final String FILENAME_HEADER = "fileName";
    private static final String FILELASTMOD_HEADER = "fileLastMod";
    // this method transfers the prescribed file to the server.
    // if the destination directory is "", it transfers the file to
    "d:\\".
    //11-21-02 Changes : This method now has a new parameter that
    references the item
    //that is being transferred in the import list.
    public static String transferFile(String srcFileName, String
    destFileName,
    String destDir, int itemID)
    if (destDir.equals(""))
    destDir = "E:\\FTP\\incoming\\";
    // get the fully qualified filename and the mere filename.
    String fqfn = srcFileName;
    String fname =
    fqfn.substring(fqfn.lastIndexOf(File.separator)+1);
    try
    //importTable importer = jbInit.getImportTable();
    // create the file to be uploaded and a connection to
    servlet.
    File fileToUpload = new File(fqfn);
    long fileSize = fileToUpload.length();
    // get last mod of this file.
    // The last mod is sent to the servlet as a header.
    long lastMod = fileToUpload.lastModified();
    String strLastMod = String.valueOf(lastMod);
    URL serverURL = new URL(webadminApplet.strServletURL);
    URLConnection serverCon = serverURL.openConnection();
    // a bunch of connection setup related things.
    serverCon.setDoInput(true);
    serverCon.setDoOutput(true);
    // Don't use a cached version of URL connection.
    serverCon.setUseCaches (false);
    serverCon.setDefaultUseCaches (false);
    // set headers and their values.
    serverCon.setRequestProperty("Content-Type",
    "application/octet-stream");
    serverCon.setRequestProperty("Content-Length",
    Long.toString(fileToUpload.length()));
    serverCon.setRequestProperty(FILENAME_HEADER, destDir +
    destFileName);
    serverCon.setRequestProperty(FILELASTMOD_HEADER, strLastMod);
    if (webadminApplet.DEBUG) System.out.println("Connection with
    FTP server established");
    // create file stream and write stream to write file data.
    FileInputStream fis = new FileInputStream(fileToUpload);
    OutputStream os = serverCon.getOutputStream();
    try
    // transfer the file in 4K chunks.
    byte[] buffer = new byte[4096];
    long byteCnt = 0;
    //long percent = 0;
    int newPercent = 0;
    int oldPercent = 0;
    while (true)
    int bytes = fis.read(buffer);
    byteCnt += bytes;
    //11-21-02 :
    //If itemID is greater than -1 this is an import file
    transfer
    //otherwise this is a header graphic file transfer.
    if (itemID > -1)
    newPercent = (int) ((double) byteCnt/ (double)
    fileSize * 100.0);
    int diff = newPercent - oldPercent;
    if (newPercent == 0 || diff >= 20)
    oldPercent = newPercent;
    jbInit.getImportTable().displayFileTransferStatus
    (itemID,
    newPercent);
    if (bytes < 0) break;
    os.write(buffer, 0, bytes);
    os.flush();
    if (webadminApplet.DEBUG) System.out.println("No of bytes
    sent: " + byteCnt);
    finally
    // close related streams.
    os.close();
    fis.close();
    if (webadminApplet.DEBUG) System.out.println("File
    Transmission complete");
    // find out what the servlet has got to say in response.
    BufferedReader reader = new BufferedReader(
    new
    InputStreamReader(serverCon.getInputStream()));
    try
    String line;
    while ((line = reader.readLine()) != null)
    if (webadminApplet.DEBUG) System.out.println(line);
    finally
    // close the reader stream from servlet.
    reader.close();
    } // end of the big try block.
    catch (Exception e)
    System.out.println("Exception during file transfer:\n" + e);
    e.printStackTrace();
    return("FTP failed. See Java Console for Errors.");
    } // end of catch block.
    return("File: " + fname + " successfully transferred.");
    } // end of method transferFile().
    } // end of class fileTransferClient
    Server side code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.net.*;
    // This servlet class acts as an FTP server to enable transfer of
    files
    // from client side.
    public class FtpServerServlet extends HttpServlet
    String ftpDir = "D:\\pub\\FTP\\";
    private static final String FILENAME_HEADER = "fileName";
    private static final String FILELASTMOD_HEADER = "fileLastMod";
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException,
    IOException
    doPost(req, resp);
    public void doPost(HttpServletRequest req, HttpServletResponse
    resp)
    throws ServletException,
    IOException
    // ### for now enable overwrite by default.
    boolean overwrite = true;
    // get the fileName for this transmission.
    String fileName = req.getHeader(FILENAME_HEADER);
    // also get the last mod of this file.
    String strLastMod = req.getHeader(FILELASTMOD_HEADER);
    String message = "Filename: " + fileName + " saved
    successfully.";
    int status = HttpServletResponse.SC_OK;
    System.out.println("fileName from client: " + fileName);
    // if filename is not specified, complain.
    if (fileName == null)
    message = "Filename not specified";
    status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    else
    // open the file stream for the file about to be transferred.
    File uploadedFile = new File(fileName);
    // check if file already exists - and overwrite if necessary.
    if (uploadedFile.exists())
    if (overwrite)
    // delete the file.
    uploadedFile.delete();
    // ensure the directory is writable - and a new file may be
    created.
    if (!uploadedFile.createNewFile())
    message = "Unable to create file on server. FTP failed.";
    status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    else
    // get the necessary streams for file creation.
    FileOutputStream fos = new FileOutputStream(uploadedFile);
    InputStream is = req.getInputStream();
    try
    // create a buffer. 4K!
    byte[] buffer = new byte[4096];
    // read from input stream and write to file stream.
    int byteCnt = 0;
    while (true)
    int bytes = is.read(buffer);
    if (bytes < 0) break;
    byteCnt += bytes;
    // System.out.println(buffer);
    fos.write(buffer, 0, bytes);
    // flush the stream.
    fos.flush();
    } // end of try block.
    finally
    is.close();
    fos.close();
    // set last mod date for this file.
    uploadedFile.setLastModified((new
    Long(strLastMod)).longValue());
    } // end of finally block.
    } // end - the new file may be created on server.
    } // end - we have a valid filename.
    // set response headers.
    resp.setContentType("text/plain");
    resp.setStatus(status);
    if (status != HttpServletResponse.SC_OK)
    getServletContext().log("ERROR: " + message);
    // get output stream.
    PrintWriter out = resp.getWriter();
    out.println(message);
    } // end of doPost().
    } // end of class FtpServerServlet

    OK - the problem you describe is definitely what's giving you grief.
    The workaround is to use a socket connection and send your own request headers, with the content length filled in. You may have to multi-part mime encode the stream on its way out as well (I'm not about that...).
    You can use the following:
    http://porsche.cis.udel.edu:8080/cis479/lectures/slides-04/slide-02.html
    on your server to get a feel for the format that the request headers need to take.
    - Kevin
    I get the out of Memory Error on the client side. I
    was told that this might be a bug in the URLConnection
    class implementation that basically it wont know the
    content length until all the data has been written to
    the output stream, so it uses an in memory buffer to
    store the data which basically causes memory issues..
    do you think there might be a workaround of any kind..
    or maybe a way that the buffer might be flushed after
    a certain size of file has been uploaded.. ?? do you
    have any ideas?

Maybe you are looking for

  • Training and Event Management in XSS

    Hello Forum, I'm running ERP 2004, Portal 6.0, MSS/ESS Business Package 60.1. Where can I configure Training Management for ESS? There are no Worksets, iViews, Pages, ... for this application in my Portal Catalog. I have the same problem with Team Vi

  • How to print from iweb

    Does anyone know how to print out of iweb, preferably all the pages in sequence to a single pdf file. Thanks

  • Don't want spouse & children to appear on address label

    I'm trying to print mailing labels from Address Book. Unless I have the "Company" box checked, Address Book is putting the spouse & all the childrens names along side the adult name on the first line of the address label. How do I stop these names fr

  • Capture One DB and Pro v3

    I'm considering the upgrade, but not confident about the compatiblity of the OS with Capture One. Does anyone have feedback as about the performance of the application on 10.6?

  • Exit codes from PowerBuilder executable in Redwood

    We are currently in the process of Integration Testing for SAP Go-Live planned for March 31, 2008.  Our Integration Testing is being done thru Redwood Job Scheduler.  There appears to be a problem with exit codes from our PowerBuilder executable that