Download and Upload using applet

hi everyone,
i tried to develop an applet that can handle upload and download file from server to client and vice versa.
is there anyone can help me?
Please help.
thank you for replies.

You need to sign your applet and the user needs to trust this signature in order for the
applet to read from the local filesystem and or connect to a server other than the one the
applet came from.
http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
second post
Here is some code that will upload (both msjvm and sun jre) but I never really finished
it. Note that if you use the applet with msjvm the client has to adjust java security in IE
import java.awt.*;
import java.net.*;
import java.io.*;
public class srvHead extends java.applet.Applet implements Runnable{
     String c = "";
     public srvHead(){
          new Thread(this).start();
     public void init(){
//          new Thread(this).start();
     public void run(){
          try{
// run this as an application first, when it works than make an applet of it
               URL u = new URL("http://localhost:101/test");
               URLConnection c = u.openConnection();
               // post multipart data
               c.setDoOutput(true);
               c.setDoInput(true);
               c.setUseCaches(false);
               // set some request headers
               c.setRequestProperty("Connection", "Keep-Alive");
// TODO: get codebase of the this (the applet) to use for referer
               c.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
               c.setRequestProperty("Content-Type", "multipart/form-data; boundary=****4353");
               DataOutputStream dstream = new DataOutputStream(c.getOutputStream());
// write content to the server, begin with the tag that says a content element is comming
               dstream.writeBytes("--****4353\r\n");
// discribe the content, (in this case it's a file)
               dstream.writeBytes("Content-Disposition: form-data; name=\"myfile\"; filename=\"C:\\myFile.wav\"\r\nContent-Type: application/octet-stream\r\n\r\n");
// open a file
               String title = "Frame Title";
               Frame frame = new Frame("Select a file");
               FileDialog fd = new FileDialog(frame);
               frame.setSize(400, 400);
               fd.show();
               System.out.println(fd.getDirectory() + fd.getFile());
               File f = new File(fd.getDirectory() + fd.getFile());
               FileInputStream fi = new FileInputStream(f);
// keep reading 1000 bytes from the file
               byte[] bt = new byte[1000];
               int cnt = fi.read(bt);
               while(cnt==bt.length){
                    dstream.write(bt,0,cnt);
                    cnt = fi.read(bt);
// send the last bit to the server
               dstream.write(bt,0,cnt);
// now close the file and let the web server know this is the end of this form part
               dstream.writeBytes("\r\n--****4353\r\n");
// send a form part named TargetURL with the value: /IntranetContent/TelephoneGuide/Upload/
               dstream.writeBytes("Content-Disposition: form-data; name=\"TargetURL\"\r\n\r\n");
               dstream.writeBytes("/IntranetContent/TelephoneGuide/Upload/");
// let the web server know this is the end of this form part
               dstream.writeBytes("\r\n--****4353\r\n");
// send a form part named redirectURL with the value: http://none/none
               dstream.writeBytes("Content-Disposition: form-data; name=\"redirectURL\"\r\n\r\n");
               dstream.writeBytes("http://none/none");
// this is the last information part of the multi part request, close the request
// close the multipart form request
               dstream.writeBytes("\r\n--****4353--\r\n\r\n");
               dstream.flush();
               dstream.close();
               fi.close();
               try{
                    DataInputStream in =
                         new DataInputStream(
                              new BufferedInputStream(c.getInputStream()));
                    String sIn = in.readLine();
                    boolean b = true;
// TODO: this will loop forever unless you make sure your server page
// sends a last line like "I am done"
// than you can do wile(sIn.compareTo("I am done")!=0){
                    while(sIn!=null){
                         if(sIn!=null){
                              System.out.println(sIn);
                         sIn = in.readLine();
               }catch(Exception e){
                    e.printStackTrace();
          }catch(Exception e){
               e.printStackTrace();
     public static void main(String[] args) {
               new srvHead();
}

Similar Messages

  • File download and Upload using SOAP in Oracle ADF

    Hi Gurus,
    I have a requirement of Uploading and downloading a file on a location. It is for uploading and downloading an Attachments for a user. I have a table in my jspx page for showing the current attachments and an option to upload a new attachment. When I click on attachment name, the file should be downloaded.
    The current implementation does this using SOAP web service. Now, i need to do it with ADF now.
    For Uploading and downloading, i have used FileDownloadActionListner on my page. I am not able to figure out how to use SOAP service in ADF to download or upload a file. what i have done is
    1. Create WebService Data Control with the exposed wsdl.
    2. Created .jspx page and binded the fuctions to the button.
    3. In managed bean class, i have written code to get reference to that web service and invoke it. I am assuming of making the currect call as the response object is not coming as null.
    Now i need to know:
    1. How to verify for the success response from a SOAP web service in the managed bean code.
    2. how to go ahead with the implementation.
    For Upload: I have filename, content and mimetype in the managed bean code function. but how to use those to make a soap call and upload a file at the location.
    For Download: I have DocumentId in the managed bean code function, and how to use it to download a file. How to get the SOAP response in managed bean code and how to handle it.
    Thanks in Advance,
    regards,
    Rajan

    Hi,
    don't have an example, but I suggest to use a JAX-WS proxy client and access it from the POJO DC (instead the WS DC) so you have access to the service responses
    Frank

  • After hours of back-up, downloading and uploading...I am now updated with all the latest Mac software. However, I no longer have access to Excel and Word. Is there a way I can access my documents in either of those? Help, please.

    After hours of back-up, downloading and uploading...I am now updated with all the latest Mac software. However, I no longer have access to Excel and Word. Is there a way I can access my documents in either of those? Help, please.

    If you have older versions of excel and word that previously ran under the Rosetta emulator (allows PowerPC code to run on Intel system), they will no longer work with Lion.
    You can use the Apple programs Pages and Numbers to access the files. They can be bought and downloaded from the App store. NeoOffice is available at http://www.neooffice.org/neojava/en/index.php which has Lion support. OpenOffice doesn't talk to Lion support, it's at http://www.openoffice.org/

  • PO header attachment download and upload

    Hi All,
    I have requirement to download the attachments attached at Purchase Orders(PO) header level . And then from the downloaded file , I further want to upload it to another target system.
    I have already uploaded the PO at target system but header level attachments were missed out.
    My source and target system is in Ver 4.6C
    Please let me know -
    1. All tables that are involved in storing the attachments at header level for purchase orders.With this I can upload attachments directly to the target system tables.
    2.Any Function module for download and upload the attachments of PO at header level.
    I will appreciate any help to do this .
    Thanks
    Deepak

    Hi ,
    Thanks for suggestion.I Have used FM SO_ATTACHMENT_INSERT to insert Attachment. SOOD table is getting updated. But still PO header level attachment is missing. I think FM only update the table SOOD and do not ensure to put the attachment to the right Purchase order.
    Please let me know if you have an Idea how to put attachments to PO header level.Let me know tables that can be directly updated in order to attach the attachment to PO header level.
    Thanks
    Deepak

  • Download and Upload smartform in 4.6c

    I have the requirement to download and upload the smartforms in 4.6c. I need the help, which standard function module will solve the problem.
    Thanks .
    Vinayak.

    Hi,
    Use Transaction "Smartforms" -->Enter Smartform Name
    -> Utilities> Download form
    This will down load smartform in XML format.
    Use the Utilities--> Upload for upload the form .
    Please sure the upload file is in XML format.
    Hope this will help you.
    Lanka

  • Download and upload of file to server dir (AL11)

    Hello,
    I have a custom program that is downloading files from application server directory (they are like templates) to user local pc. User is then modifying such files and finally upload them in another AS directory.
    The program is currently making use of FM's C13Z_FILE_DOWNLOAD_BINARY and  C13Z_FILE_UPLOAD_BINARY.
    There was no problem until hot packages have been implemented: now such FM's are returning an error saying:
    Internal program error; (YDOWNLOAD SAPLC13Z 0 C13Z_RAWDATA_WRITE)
    When in debug, it appears that the FM C13Z_RAWDATA_WRITE (called by the above mentioned FM's) is checking the calling program (sy-cprog) and if this latter is not within a list of standard programs (hardcoded), then the error is thrown.
    My question is: Is there another way to download and upload files without such error? Could you please share the code?
    Thanks a lot for help and suggestions!
    Best regards,
    JFlanders

    Hello,
    Please see note   1809258 - Internal program error; ( <program name> SAPLC13Z 0 C13Z_RAWDATA_READ )
    A possibile solution is to use cl_gui_frontend_services class methods like gui_download and gui_upload, for instance:
    TYPES: t_line(1) type x.
    DATA: i_tab TYPE STANDARD TABLE OF t_line,
        i_wa(1) type x.
    OPEN DATASET lv_file_appl FOR INPUT IN BINARY MODE.
    DO.
      CLEAR i_wa.
      READ DATASET lv_file_appl INTO i_wa.
      IF SY-SUBRC <> 0.
        EXIT.
      ELSE.
        APPEND i_wa TO i_tab.
      ENDIF.
    ENDDO.
    CLOSE DATASET lv_file_appl.
    DATA: lv_fn TYPE string.
    lv_fn = lv_file_name.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = lv_fn
        filetype                = 'BIN'
        append                  = ' '
      CHANGING
        data_tab                = i_tab
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 24.
    * old functioanlity
    *    CALL FUNCTION 'C13Z_FILE_DOWNLOAD_BINARY'
    *      EXPORTING
    *        i_file_front_end       = lv_file_name
    *        i_file_appl            = lv_file_appl
    *        i_file_overwrite       = 'X'
    ** IMPORTING
    **    E_FLG_OPEN_ERROR          =  false
    **    E_OS_MESSAGE              =  lv_message
    *    EXCEPTIONS
    *      fe_file_open_error       = 1
    *      fe_file_exists           = 2
    *      fe_file_write_error      = 3
    *      ap_no_authority          = 4
    *      ap_file_open_error       = 5
    *      ap_file_empty            = 6
    *      OTHERS                   = 7
    This is for the download, similarly should be done for the upload.
    Hope this could help. Let me know if further details are needed.
    Thank you and bye,
    Flavio

  • Download and Upload Modulepool program

    hai all,
       Could any one say how to Download and Upload Modulepool program from sap.
    Thanks,
    Jeevan.

    Hi Puduru
    Welcome to ABAP forums.
    If you just want to export Module pool program once, you can use transaction SE80 and menu point Utilities->More Utilities->Upload/Download->Download option ( for each include / component ).
    Save it as a text file and then repeat the same process.
    Here's other programs for the same functionality. You can use one of them.
    http://www.members.tripod.com/abap4/Upload_and_Download_ABAP_Source_Code.html
    http://sap.ittoolbox.com/code/d.asp?d=1623&a=s
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/finding your code in bsp applications.article
    http://www.geocities.com/rmtiwari/Resources/Utilities/WebViewer.html
    http://www.dalestech.com/
    Dont forget to rewards pts, if it helps ;>)
    Regards,
    Rakesh

  • Download and upload speed per ssid in air-sap2602.

    Dear team,
    How to limit the download and upload speed per ssid in air-sap2602 ?
    SSID =5MB download + 1upload
    SSID= 30MB download + 5upload
    Regards

    If you need help with traffic shaping, you should post your question on the rLAN, Switching and Routing forum:
    https://supportforums.cisco.com/community/netpro/network-infrastructure/switching
    You can also look for examples by searching Configure 1941 traffic shaping:
    http://www.cisco.com/en/US/docs/ios/12_2/qos/configuration/guide/qcfgts.html
    http://www.cisco.com/en/US/docs/ios/12_2/qos/configuration/guide/qcfcbshp.html
    Thanks,
    Scott
    Help out other by using the rating system and marking answered questions as "Answered"

  • How to download  and upload a module pool program ?

    hi i am a sudent.can anyone suggest me how to download and upload a module pool program?
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on May 29, 2011 12:45 PM

    Hi,
    You cannot just download and upload module pool programs .
    There are 2 different ways.
    1. Copy all the includes and and create the same in the target system. You can download and upload the the Screen.
      But GUI status you have to manually create.
    2. If you have completely saved the module-pool program in one Workbench request(including Z tables u have used) in the original system ,just  release the workbench request and copy the data file and co file and upload to the target system ( use CG3Y & CG3Z).
    If the workbench is a Local Request save it in a Transport of copies and then move.
    Regards
    Aromal R

  • My MBA keep downloading and uploading with no obvious reason?

    Here is a link to the original post https://discussions.apple.com/thread/3015185
    I will go crazy over this one! The problem started almost 10 days ago .
    My Mac Book air keeps downloading and uploading KBs ranging from 2 KBsto 30 KBs Ups and Downs (see the attachment please ).
    I'm living currently in Amman/Jordan and using Orange 3G+ USB dongle and InternetEverywhere software to connect (check the screen shot).
    I also installed Protemac and there was no app I tracked which was the reasonbehind the constant download/upload during idle time .
    I did everything; formatted and clean installed Os X , installed antivirus(nothing found ),checked the USB dongle with Windows 7 operating system and tomy surprise everything is fine .
    I tried to reinstall the driver many times from http://www.orange.jo/en/software.php and again nothing has changed the same behavior again !
    I called Orange tech support and they said if there is no  problem with Windows 7 there is nothing that we can do .
    What I have noticed is that when I connect to internet the Orange software only downoald 11 KBs and then stopped ,the preoblem start when I open a page on firefox or Safari and then after seconds the activity monitor start to regestier upload and downalod activity (both ways) ranging from 3 KBs ups and 3 KBs downn to 25 KBs Ups and 25 KBs down , this is just like a loop activity .
    Should I leave this problem to eat all my bandwidth threshold ,is their something wrong with my MBA ( I hope not )
    Please help me with this .

    Here is a snap shot of CPA - Cocoa Packet Analyzer,the thing is that I don't know how to translate the packets being sent or received

  • Can anyone explain how to download and upload TROY ECF fonts with SAP

    Can anyone explain how to download and upload TROY ECF fonts with SAP.I have downloaded ECF font from TROY wesite as TTF format. but it is not getting upload with SAP.please kindly help me on this issue..

    Hi,
    You can use the SE73 Transaction and upload your TTF files.
    Please check the link here for more details:
    http://help.sap.com/saphelp_nw70/helpdata/en/36/5b3438fd263402e10000009b38f8cf/frameset.htm
    Regards,
    Siddhesh

  • How to download and upload files in Java?

    Hi, everyone
    How to download and upload files in Java? Do you have some references about this issue or some valuable web link�? Thanks!
    Best Regards,
    Hai.Ren

    This is too vague a question, please be more specific. What protocol would you like to use? HTTP? FTP? Something else?

  • How to download and upload TROY ECF fonts with SAP for check printing

    Can anyone explain how to download and upload TROY ECF fonts with SAP.I have downloaded  ECF font from TROY wesite as TTF format. but it is not getting upload with SAP.please kindly help me on this issue..

    Hi,
    You can use the SE73 Transaction and upload your TTF files.
    Please check the link here for more details:
    http://help.sap.com/saphelp_nw70/helpdata/en/36/5b3438fd263402e10000009b38f8cf/frameset.htm
    Regards,
    Siddhesh

  • How to download and upload BDC programs

    How to download and upload BDC programs from one instance to another instance? I would like to transport my BDC programs from one dev client to another Dev client not through transport like smartforms.(we can download smartforms to desktop and upload to someother client)

    Hi,
    No need to record again. You can save the recording session by generating the program in transaction SHDB. Then you can download the BDC program and upload to another SAP client using transaction SE38.
    Regards,
    Ferry Lianto

  • I have the Jetpack 4GLTE, what is the Mbps download and upload speeds for this device?

    I have the Jetpack 4GLTE, what is the Mbps download and upload speeds for this device?

    The avgrage real speed will be more in the area of 25 to 38 Mbps  You would need to be in a strong signal area with high grade cell tower service and low customer use to even reach 50 Mbps. 
    From Verizon page.  Just be aware that using the MiFi 6620L can cost a lot of money. And you can thank the device's fast performance for that. In my testing around the San Francisco Bay Area, rathe device delivered blazing-fast download speeds that nged between around 10Mbps to around 40Mbps. At those speeds, you can burn through 4GB of data in just less than an hour. Once you reach the cap, of course, you'll have to pay somewhere between $10 to $15 for each additional gigabyte, depending on the plan you sign up for. 
      For more information follow link:  Verizon Ellipsis Jetpack MHS800L | Verizon Wireless

Maybe you are looking for