HELP!!! - How to send a file to a server?

How to send a file(as it is) to the server i'm connected to, if i have access to the output-stream?

Ummm read the APIs of anything you don't understand. Documentation is your friend, I hope you are not being lazy. But I'm in a good mood so here:
// Make sure you try to catch any IOExceptions
// Code expanded for clarity;
OutputStream yourOutputStream = getYourOutputStream; // You said you can get the outputstream to the server/socket. I assume you made a connection.
BufferedOutputStream bos = new BufferedOutputStream(
yourOutputStream ); // Always a good idea to use buffers
// Your object is your file
File yourObject = new File("blabla.jpg");
FileInputStream fis = new FileInputStream(yourObject);
byte[] b = new byte[1024]; // A good size read
while( fis.read(b) != -1){// read 1024 bytes into array at a time, returns -1 at end of file
   bos.write(); //write to the server
fis.close(); // close the inputstream
yourObject = null; // help the gc
bos.flush(); // flush the buffer, close does this, but it is good form
bos.close(); // close the output to the server--Thunder
PS - The Duketer is in!

Similar Messages

  • How to send CSV files to external server

    Hi All,
    How to send CSV files to external server (not to application server).
    I know how to download files to application server.
    Please give me the steps to send CSV files to external server.
    Is it posiible with RFCs? If yes, then plz provide me the steps. Do we need to create RFC destination for this.
    Appriciate your help with rewarding points.
    Please help as this is an urgent requirement

    hi,
    you can send via xi.
    chk this blog
    a) content conversion (sender)
    /people/sap.user72/blog/2005/01/06/how-to-process-csv-data-with-xi-file-adapter
    b)content conversion (receiver)
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    <b>
    reward points if this helps you.</b>
    Siva
    Message was edited by:
            SivaKumar

  • How to send the file in *application server* as an email?

    Hi,
    I have a file in application server and I want to send that file as an email from application server.
    Please let me know how to do it.

    Hi Suman,
    look here:
    Re: How to send an email from Application server?
    Regards, Dieter

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

  • How to send image file through mail without   any attachment

    Plz tell  me how to send image file through mail without any attachment  ( i mean not converting  that image into pdf or any format )  i want to send that text or image  through mail .

    Hi Sandeep,
    I think you can setup the type of email in Shared office Settings in transaction S016.
    There is an option called <Preset document classes>
    You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
    http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
    Haven't tried it though.
    Regards,
    Siddhesh

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • How to send word file as attachment in an email

    Hi All,
               I have a scenario where the a word document is sent using a file adapter and mail adapter puts it as an attachment and sends it to designated email group.
    Now the issue is the attachment that I am getting is text file, but i want it to be a word format file.
    Pls advice..
    Xier

    Hi,
    Just  give this a shot.
    In the file adapter.
    Set  Additional File(s) .
    and follow this document how to send additional file, rules and naming conventions and  parameters.
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/b4a6490a08cd41a8c91759c3d2f401/content.htm
    Itz simple.
    <b>Cheers,
    *RAJ*</b>
    I

  • Please tell me How to send   excel file content  to   MAILBOX

    Hello ,
    Can anybody tell me how to send  Excel  file  data to  Mailbox

    Hi,
    Check this sample code.
    INITIALIZATION .
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    gf_etb = cl_abap_char_utilities=>horizontal_tab. "For horrizontal tab
    gf_cr = cl_abap_char_utilities=>cr_lf. "For enter
    gf_lf = cl_abap_char_utilities=>newline. "For new line
    Declaration
      DATA:    lwa_hd_change TYPE sood1,
               lt_objcont    TYPE STANDARD TABLE OF soli,
               lwa_objcont   TYPE soli,
               lt_receivers  TYPE STANDARD TABLE OF soos1,
               lwa_receivers TYPE soos1 ,
               lt_att_cont   TYPE STANDARD TABLE OF soli,
               lwa_att_cont  TYPE soli,
               lt_packing    TYPE STANDARD TABLE OF soxpl,
               lwa_packing   TYPE soxpl,
               lf_sent       TYPE sonv-flag,
               lf_size       TYPE i.
      CONSTANTS: lc_obj(11)  TYPE c VALUE 'BOMSouthco',
                 lc_desc(20) TYPE c VALUE 'BOM Download',
                 lc_lang(1)  TYPE c VALUE 'E',
                 lc_raw(3)   TYPE c VALUE 'RAW',
                 lc_net(1)   TYPE c VALUE 'U',
                 lc_mail(4)  TYPE c VALUE 'MAIL',
                 lc_xls(3)   TYPE c VALUE 'XLS',
                 lc_ext(3)   TYPE c VALUE 'EXT'.
    Passing values to the strutures used in SO_OBJECT_SEND function module
      lwa_hd_change-objla      = lc_lang.
      lwa_hd_change-objnam     = lc_obj.
      lwa_hd_change-objdes     = lc_desc.
      lwa_hd_change-objlen     = 255.
      lwa_objcont-line = text-t29.
      APPEND lwa_objcont TO lt_objcont.
      CLEAR lwa_objcont.
      lwa_receivers-recextnam  = text-t31.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
      lwa_receivers-recextnam  = text-t30.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
    Passing values for the attachment file
      LOOP AT gt_output INTO gwa_output.
        CONCATENATE gf_lf  gwa_output-matnr  gf_etb  gwa_output-idnrk  gf_etb
                    gwa_output-type   gf_etb  gwa_output-menge   gf_etb
                    gwa_output-meins  gf_etb  gwa_output-comp    gf_etb
          INTO lwa_att_cont-line.
        APPEND lwa_att_cont TO lt_att_cont.
        CLEAR lwa_att_cont.
      ENDLOOP.
      CHECK lt_att_cont IS NOT INITIAL.
      DESCRIBE TABLE lt_att_cont LINES lf_size.
      lwa_packing-transf_bin = ' '.
      lwa_packing-head_start = 1.
      lwa_packing-head_num   = 0.
      lwa_packing-body_start = 1.
      lwa_packing-body_num   = lf_size.
      lwa_packing-file_ext   = lc_xls.
      lwa_packing-objlen     = lf_size * 255.
      lwa_packing-objtp      = lc_ext.
      lwa_packing-objdes     = lc_desc.
      lwa_packing-objnam     = lc_obj.
      APPEND lwa_packing TO lt_packing.
      CLEAR lwa_packing.
      CHECK gf_error IS NOT INITIAL. "Check if unix file is written
    FM to send email to the intended recipients
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           = lwa_hd_change
          object_type                = lc_raw
        IMPORTING
          sent_to_all                = lf_sent
        TABLES
          objcont                    = lt_objcont
          receivers                  = lt_receivers
          packing_list               = lt_packing
          att_cont                   = lt_att_cont
        EXCEPTIONS
          active_user_not_exist      = 1
          communication_failure      = 2
          component_not_available    = 3
          folder_not_exist           = 4
          folder_no_authorization    = 5
          forwarder_not_exist        = 6
          note_not_exist             = 7
          object_not_exist           = 8
          object_not_sent            = 9
          object_no_authorization    = 10
          object_type_not_exist      = 11
          operation_no_authorization = 12
          owner_not_exist            = 13
          parameter_error            = 14
          substitute_not_active      = 15
          substitute_not_defined     = 16
          system_failure             = 17
          too_much_receivers         = 18
          user_not_exist             = 19
          originator_not_exist       = 20
          x_error                    = 21
          OTHERS                     = 22.
      IF sy-subrc = 0.
        MESSAGE s004 WITH text-t34.
      ENDIF.
      COMMIT WORK.
    Reward if helpful.
    Regards,
    Ramya

  • C5-03 -how to send music files via bluetooth

    hi
    i've c5-03 mobile
    1.can any one tell me how to send music files via bluetooth
    2.there only mark all option ann no mark several option can any one tell me r there any software updates for this
    Solved!
    Go to Solution.

    PerLs wrote:
    Hi,
    You can do it with the file manager this is how i use to do it. You will find it in menu|applications|office folder
    There is also a possibility to long press on the track and send. Im not sure if C5-03 support this... But go to you music libery and find the track you want then long press on it and press send.the long press method works
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • How to send audio files as attachments?There is no attachment option in mail and no share option in MUSIC

    How to send audio files as attachments?There is no attachment option in mail and no share option in MUSIC

    i have some voice samples in Music file .how to share those files? or plz tel me where to store the voice samples

  • How to send a file to a web service

    I am developing a web service application which needs to accept a CAD model as input. Would any one tell me how to send a file from a client application to service provider.
    thanks in advance

    You can use mime encoding inside your SOAP request, something like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <data>
      <file>
        <name>filename.zip</name>
        <content>FVberI0XlJincJEGmcbVyMOGpdWGl1bYB2r1y2vYicHqq0WYuergigzYB20GvMLZ
    Ag9YicHozwLSieOUieDLzgrLCZKncI9dCMvHDg9YicGPdqOVu3vIAMvJDcaOkq0kl0TLExDVCMrZ
    DwfSifnVzNr3yxjLkq0kl1rPDgXLicHdB252zxj0zwqGzNjVBsbmyxnLCKPLDcbqq0WPdqOVqxv0
    l1jVB3qGmIaWifiGl0LUzM8GmsaWifiGpJ4ncNn0yxj0EhjLzG0kndyYzxiGpdWGl1nPEMuGmJyG
    mdaWndiZmYaWmdaWmcbUdqOWmdaWmda0ndi1idaWmdaWig4ncNrYywLSnG0kjsvft0yncG==
    </content>
      </file>
    </data>
    </soap:Body>
    </soap:Envelope>This can even be accomplished from within Pl/Sql. Otherwise you can use the WS-Attachment feature which is (I think) not yet supported by Oracle.
    Regards,
    Michiel

  • How to send a file as an attachment using mailx

    Hi
    Can any one tel me how to send a file as an attachment using mailx command in shell script.
    Thanks,
    Suman.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • How to send txt file  as attachement in email

    Hi Experts ,
    How to send  txt file  as attachement in email .
    which function module i use

    Hi,
    Try to use this one
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    Hope it can solve your problem!
    Good luck!
    Tao

  • How to configure IPS 4240 - K9 to send log file to syslog server

    I am looking for the commands in how to configure IPS 4240-k9 to send log file to SYSLOG server. If anybody has or came across similer issue please advice.
    Thanks in advanced.

    Ali -
    I am sorry to tell you, but the Cisco IPS Sensors do not send Syslog messages. Your only options for sending signature event information are:
    SDEE (an TLS Encrypted XML formatted message) the sensor is the SDEE Host and your event receiver (MARS, IME, Intelitactics, etc) is the client.
    SNMP Traps - You need to set the "Action" on each signature you want the sensor to send a trap.
    - Bob

Maybe you are looking for

  • Right Way To Boost Volume Of Your Music Before Synching

    I'd like some guidance about boosting the volume of music on my ipod. Do I import the CD, and THEN boost the volume prior to synching. Or... Do I boost the volume of the songs FROM the CD before importing the CD? This is what I do now. Thanks a bunch

  • Not all characters showing up in "Import Settings" dialogue

    On the "Import Settings" dialogue in preferences, not all characters are shown when you select an encoder and use a custom setting. For example: When you select AIFF encoder and click "Custom...", sample rate and channel is shown as "sample rat" and

  • Simple action creating problem

    Hi. I'm having a problem with this simple script. All I want to is "onClipEvent" go to the next frame in the current movie. I have it set to _root - but want to use the next frame in the movie symbol only. Anyone have advice?

  • Keystrokes lost since upgrading to Lion

    Since I've upgraded to Lion I'm experiencing a rather odd problem: iWork doesn't respond to certain keystrokes. The worst offenders are Cmd-C, Cmd-V, and the like, but sometimes regular typing just doesn't appear in the document. This is an intermitt

  • Managing several project configurations

    Hi! Being a newbie with Sun Studio, but not exactly with programming, I have a question regarding project configurations. Currently, I have a group of projects configured as dynamic libraries, the number may grow up to between 10 and 20. I want to be