Remote machine file upload

Aloha:
I am newbie to servlet programming:
I am trying to send a file from one machine (A) to another machine(B) and both the systems have webservers running on them. Once B recieves the file the result needs to be sent back to A. How can i accomplish this using web servers. I don't have permission to FTP RCP etc on either machines.
Can someone help me here??
TIA
FSK

Check out multipart form uploads.
There are loads of classes that can do this.
servlet a simply http uploads the file to b).
b) runs some check on the file to ensure it is valid, then calls a servlet back on a) to say its ok.
Look on the apache.org site for the commons upload class.

Similar Messages

  • Show browse files dialog by listing remote machin files in web application

    Hi all,
    I want to develop a web application which has "Browse Server" button to browse remote server. After selecting files and folders from remote server, need to read all files and folders from server and store that information in Database. Please provide some ideas and help regarding this.
    I think that i need to develop a custom component based on jfilechooser to connect to server and show the selection dialog like windows file upload.
    I don't no how to list server files and show as browse dialog to select and read those files.
    Thanks in advance.
    Regards,
    Venkata Subba Reddy

    Most web browsers can browse FTP. You can achieve what you want without writing a single line of code. How cool is that?

  • Remote machine file copy

    Hi,
    I am looking out for a code to copy a file to a remote server which does not support http but i have access to it.
    My requirement is to do this using a core java code at only the client side.
    Any help would be greatly appreciated

    I'm not sure that correctly understand your task. IMO your questions should be in java forum.
    Assume you have a ftp access to server. Then you can look at java ftp support libaries or simply invoke external ftp client to copy file. See http://forums.sun.com/thread.jspa?threadID=5395532.

  • 9i File Upload not working on remote machine

    Hi.
    The 9i File Upload demo utility is working fine when I invoke it locally on the same machine.
    Remotely, however, I just get a grey blank screen in the browser with the message "Applet initialized" in the status bar. The java console says that the two JAR files were downloaded successfully, and doesn't show any other error.
    When I imported the cert on the client, the expiry date had already passed (sometime in 2002). I have generated a new cert, resigned the JAR file and installed it in the correct directory. Again, the upload works fine locally, but not remotely.
    Has anyone any idea what could be wrong? I'd be very grateful for any assistance. For info, we're using 9iDS 9.0.2.1.
    Thanks,
    Peter

    Please ignore my previous message.
    I rebooted the client and it now seems to work fine.
    Thanks anyway,
    Peter

  • Help needed...   File UPload  problem on remote Machine..

    Hello Helpers....
    Advance My heartfull thanks
    me have problem in file uploading...
    me have program for file upload...
    but it will work perfectly in same system.. (i mean server)..
    i cant upload in client machine..
    resourse not found (error) is comming
    me use tomcat5.0 with jdk1.4..
    Html File
    <html>
    <head>
    <form action="fileupload.jsp" name="upform" enctype="multipart/form-data">
    <table width="60%" border="0" cellspacing="1" cellpadding="1" align="center" class="style1">
    <tr>
    <td align="left"><b>Select a file to upload :</b></td>
    </tr>
    <tr>
    <td align="left">
    <input type="file" name="filename" size="50">
    </td>
    </tr>
    <tr>
    <td align="left">
    <!-- <input type="hidden" name="todo" value="upload"> -->
    <input type="submit" name="Submit" value="Upload">
    <input type="reset" name="Reset" value="Cancel">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    jsp file
    <%@ page import="java.util.*,java.io.*"%>
    <%
    String path=request.getParameter("filename");
    String newPath="";
    int count=0;
    if(path!=null)
         ArrayList arr=new ArrayList();
         StringTokenizer st=new StringTokenizer(path,"\\");
         while(st.hasMoreTokens())
              arr.add(count,st.nextToken());
              count++;
         // create ur own path
         newPath="//javaserver/Tomcat5.0/webapps/ROOT/fileupload/fl/"+arr.get(count-1);
         int c;
         FileInputStream fis=new FileInputStream(path);
         FileOutputStream fos=new FileOutputStream(newPath);
         while((c=fis.read())!=-1)
              fos.write((char)c);
    out.println("Thanks for using");
    out.println("<br>");
    out.println("<br>");
    out.println("1.File1 Uploaded from :: "+path);
    out.println("<br>");
    out.println("<br>");
    out.println("2.Uploaded File1 is Saved in :: "+newPath);
    %>
    Message was edited by:
    drvijayy2k2
    Message was edited by:
    drvijayy2k2

    hai mshanu...
    thus me asking whats wrong any other solution..
    thanks for ur ........................
    Message was edited by:
    drvijayy2k2

  • How to read file from remote machine

    Hello,
    Hi, i would like to know how to read text file from remote machine using java source code, any code ?
    Thanks very much;
    Best regards
    Kim

    On the server, perform the following steps:
    Parse the request and determine the file to serve
    Open a FileInputStream to the appropriate file
    Obtain a reference to the Servlet OutputStream
    Pipe the bytes from the file to the output stream
    Flush and close the streamYou might want to call HttpServletResponse.setContentType("application/octet") to indicate to the browser that a file download will be occurring. Do so before getting the reference to the Servlet's OutputStream.
    - Saish

  • Since upgrading to OSX 10.6.8, I am unable to use scp on a remote machine to copy files into my iMac.

    Any suggestions?
    However, I can use scp to copy files out from my iMac (10.6.8) .
    I can ssh into the iMac OK.
    I created a .profile in my iMac home directory with the single line "export TERM=xterm-color".
    This makes a difference to how scp behaves when attempting to copy into the iMac, but it still fails.
    Thanks in advance for any help.  Peter R
    Here is the scp debug output (on the remote machine that I'm copying a file from, to the iMac):
    ===
    Executing: program /usr/bin/ssh host molika.ucsd.edu, user prowat, command scp -v -t Desktop/FromPelican/Outs201201.pdf
    Sun_SSH_1.1.3, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Rhosts Authentication disabled, originating port will not be trusted.
    debug1: ssh_connect: needpriv 0
    debug1: Connecting to molika.ucsd.edu [137.110.243.133] port 22.
    debug1: Connection established.
    debug1: identity file /home/nona/.ssh/identity type -1
    debug1: identity file /home/nona/.ssh/id_rsa type -1
    debug1: identity file /home/nona/.ssh/id_dsa type -1
    debug1: Remote protocol version 1.99, remote software version OpenSSH_5.2
    debug1: match: OpenSSH_5.2 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-Sun_SSH_1.1.3
    debug1: use_engine is 'yes'
    debug1: pkcs11 engine initialized, now setting it as default for RSA, DSA, and symmetric ciphers
    debug1: pkcs11 engine initialization complete
    debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
    Unknown code 0
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-ctr hmac-md5 none
    debug1: kex: client->server aes128-ctr hmac-md5 none
    debug1: Peer sent proposed langtags, ctos:
    debug1: Peer sent proposed langtags, stoc:
    debug1: We proposed langtags, ctos: i-default
    debug1: We proposed langtags, stoc: i-default
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: dh_gen_key: priv key bits set: 124/256
    debug1: bits set: 1007/2048
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'molika.ucsd.edu' is known and matches the RSA host key.
    debug1: Found key in /home/nona/.ssh/known_hosts:1
    debug1: bits set: 1043/2048
    debug1: ssh_rsa_verify: signature correct
    debug1: newkeys: mode 1
    debug1: set_newkeys: setting new keys for 'out' mode
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: newkeys: mode 0
    debug1: set_newkeys: setting new keys for 'in' mode
    debug1: SSH2_MSG_NEWKEYS received
    debug1: done: ssh_kex2.
    debug1: send SSH2_MSG_SERVICE_REQUEST
    debug1: got SSH2_MSG_SERVICE_ACCEPT
    debug1: Authentications that can continue: publickey,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/nona/.ssh/identity
    debug1: Trying private key: /home/nona/.ssh/id_rsa
    debug1: Trying private key: /home/nona/.ssh/id_dsa
    debug1: Next authentication method: keyboard-interactive
    *** Password requested & supplied
    debug1: Authentication succeeded (keyboard-interactive)
    debug1: fd 5 setting O_NONBLOCK
    debug1: fd 6 setting O_NONBLOCK
    debug1: fd 7 setting O_NONBLOCK
    debug1: channel 0: new [client-session]
    debug1: send channel open 0
    debug1: Entering interactive session.
    debug1: ssh_session2_setup: id 0
    debug1: channel request 0: env
    debug1: Sending command: scp -v -t Desktop/FromPelican/Outs201201.pdf
    debug1: channel request 0: exec
    debug1: channel 0: open confirm rwindow 0 rmax 32768
    ~
    debug1: channel 0: read<=0 rfd 5 len 0
    debug1: channel 0: read failed
    debug1: channel 0: close_read
    debug1: channel 0: input open -> drain
    debug1: channel 0: ibuf empty
    debug1: channel 0: send eof
    debug1: channel 0: input drain -> closed
    debug1: channel 0: write failed
    debug1: channel 0: close_write
    debug1: channel 0: output open -> closed
    debug1: channel 0: rcvd eof
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug1: channel 0: rcvd close
    debug1: channel 0: almost dead
    debug1: channel 0: gc: notify user
    debug1: channel 0: gc: user detached
    debug1: channel 0: send close
    debug1: channel 0: is dead
    debug1: channel 0: garbage collecting
    debug1: channel_free: channel 0: client-session, nchannels 1
    debug1: fd 0 clearing O_NONBLOCK
    debug1: fd 1 clearing O_NONBLOCK
    debug1: fd 2 clearing O_NONBLOCK
    debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.9 seconds
    debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
    debug1: Exit status 0

    On looking at the secure.log on the iMac with OSX10.6.8, I see these entries at each attempt to scp into the iMac:
    Dec 29 11:06:20 molika sshd[7248]: in pam_sm_authenticate(): Failed to determine Kerberos principal name.
    Dec 29 11:06:26 molika sshd[7246]: Accepted keyboard-interactive/pam for prowat from 137.110.243.132 port 35571 ssh2
    Dec 29 11:06:26 molika com.apple.SecurityServer[26]: Session 0x236a14 created
    Dec 29 11:06:26 molika com.apple.SecurityServer[26]: Session 0x236a14 attributes 0x20
    Dec 29 11:06:27 molika com.apple.SecurityServer[26]: Session 0x236a14 dead
    Dec 29 11:06:27 molika com.apple.SecurityServer[26]: Killing auth hosts
    Dec 29 11:06:27 molika com.apple.SecurityServer[26]: Session 0x236a14 destroyed
    I don't know what to make of this.
    Peter R

  • File upload through BlazeDS remote object?

    Hi,
    After researching file upload options in flex, it seems like the only option is through HTTP service requests, such as:
    private var fileRef:FileReference;
    fileRef.upload(new URLRequest(FILE_UPLOAD_URL));
    Is there any way to use BlazeDS remote objects to upload a file from Flex interface? Perhaps passing in a FileReference object and marshalling it into an equivalent Java object?
    Thanks!

    I know there is a workaround like this. It uses a servlet to upload a file and returns a url. The uploaded file is either stored in session or server file system until the session expires. Use the PropertyProxy to register a custom class which contains this url and convert to java.io.File. It is the limitation of the player. It cannot read the local file system for security reason. There is a sample in blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/blazeds/qa/remotingService/Echo.java
    static
    PropertyProxyRegistry registry = PropertyProxyRegistry.getRegistry();
    PropertyProxy proxy = registry.getProxy(java.io.File.class);
    if (proxy == null)
    registry.register(java.io.File.class, new FileProxy());
    proxy = registry.getProxy(FileReference.class);
    if (proxy == null)
    registry.register(FileReference.class, new FileReferenceProxy());
    Hope it can help

  • Creating Error log files using UTL_FILE package on a remote machine

    Database Version: 10g Release2
    OS Platform: Sun Solaris
    I have been asked to log errors to OS files rather than tables. So, i wanted to use UTL_FILE package. But the client doesn't want to store these files on the same server where the database is running(as specified in UTL_FILE_DIR). Is there a way i could get these files created on a remote machine(client).

    I believe what others are suggesting is that your stored procedure continues to log to a table and a separate process be created that runs on the machine you want the file to be created on which reads the log table and writes to a log file.
    If that is not an option, can you expose the directory on the remote machine you want to write the file to as a file share that can be mounted by the database server? If you can, you could write errors there using UTL_FILE. However, it would probably be a bad idea. If you're logging an error already, that implies that something has gone wrong. Making an error logging process dependent on a remote server being available and properly mounted with appropriate privileges at the instant the error occurs just creates more sources of failure that would prevent you from logging an error, which would prevent you from being able to debug the problem or even know it existed without a report from a user.
    Justin

  • Program to open file in remote machine

    Hi,
    i want to write a program in which i can access a file in another system.
    But the catch here is that the other system is using password to login to the system.
    How i can provide password through my Java Program to access to other machine
    ~Aman

    Can you just send me the code how to read file from Shared folder/drive through java program?
    e.g ="\\mcno-pc180\shared\HelloWorld.txt". I am able to access file HelloWorld.txt from my machine which is placed in shared folder path "\\mcno-pc180\shared\".
    Regards
    SPulluri
    Share the folder/drive which you want to access on the remote machine then your application can access it.
    Try to use the user which has already rights of reading/writing to that machine then the security dialog will not appear.

  • How to read and writre file into remote machine in the network

    HI Experts,
       i want to write the data and read data into file in remote machine(not in application server and presentation server).is it possible in abap.
    thanks in advance
    With Regads
    Naidu

    Hi naidu,
    1. We can use this type of path
    computername
    folder
    file.ext
    2. We can use this in GUI_UPLOAD
       and it will run on presentation server,
       connect to
    computer
       and read the file contents.
    regards,
    amit m.

  • How to create a file on a remote machine using PrintStream

    I want to create an HTML file on a remote machine connect via LAN the path is "\\vineet\akh\" akh is folder where I want to save the HTML file. Now in PrintStream i can give only a local file. Please help how to do it

    .. You can do this in two ways!!
    1) easy way
    2) hard way
    1) EASY WAY
    .. as you know for write to a remote dir you must
    a) have shared remote dir
    b) have write permit on remote dir
    if you have point a) and b) the way to follow it's simple as the other user explained to you!!
    2) HARD WAY
    the hard way is to use RMI (Remote Method Invokation)
    i mean to create a service on a remote machine that give to you a remote method that make you write without share anything..!!!
    check it out
    http://tns-www.lcs.mit.edu/manuals/java-api-1.1beta2/guide/rmi/
    i hope i'm been clear!!
    SORRy My english!! (please)
    Alessandro

  • Accessing a XML file located in a remote machine.

    I have a XML file located in a remote machine(source machine), and I want to be able to move the data from that file to a remote database (target).
    I have a central ODI deployment and a central master and worker repository.
    The issue I have is that it seams to me that in order to use an XML file the XML file needs to be local to the ODI client(topology manager, designer etc).
    The question what do I need to do in order to access the file located in the remote source machine if that machine does not have an ODI client?
    Thanks

    Hi Terence,
    why don't you try to put all your JPA stuff (classes, persistence.xml, etc) in a "library" jar file and then deploy it inside your .war (under META-INF/lib) and .ear (under the lib)?
    Is it acceptable for your purpose?
    Fabio De Santi

  • Transfer of file to a shared folder on remote machine

    Hi,
    I want to transfer a file present on windows machine A to a shared folder (\\16.192.54.56\Test) on machine B having ip as 16.192.54.56, using java.
    I tried using the renameTo api of File class but its not helping. It gives permission denied exception. I am able to open the shared folder from machine A using the shared folder path (\\16.192.54.56\Test) through the run command. So, that means there is no permission issue on the shared folder.
    Could anybody please guide me as to how can i resolve this issue.
    ~Brij

    Hi,
    Please pardon me for not providing the complete information.
    I have kind of root caused the issue. Let me explain the issue in detail.
    I have a logic to move a file to a shared folder on remote machine, inside my application running on a different machine. Now when i run my application using
    command prompt, the logic of moving the file to the shared folder works fine.
            try
                File fDest = new File(""\\\\15.154.52.100\\TestDir\\test");
                File fSrc = File.createTempFile("testExport", "txt");
               final int BUFFER = 2048;
               InputStream in = new FileInputStream(fSrc);
               OutputStream out = new FileOutputStream(fDest);
               // Transfer bytes from in to out
               byte[] buf = new byte[BUFFER];
              int len;
              while ( (len = in.read(buf)) > 0)
                  out.write(buf, 0, len);
              in.close();
             out.close();
             fSrc.delete())
            catch (Exception ex)
                ex.printStackTrace();
    {code}
    But when i run my application as a windows service, the logic does not work.
    I noticed that when we run our application as windows service, the owner of JVM is System and it looks like it will not have Network access permission.
    But, when we run our application through command prompt or as a standalone application, then the owner will be the user who started the application. This user will have the Network access permission.
    Please correct me if the above assumption is correct. If this is the case then how can i make my application (running as windows service), to have network access permission.
    ~Brij                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Getting absolute path of a file running in remote machine

    Hi,
    I want to get the absolute path of a file that will be created in the remote server. Inside a directory XYZ in remote machine, the file will be created and the remote machine's address is xxx.xx.x.x. I have used the following snippet
    File f=new File(Filename);
    f.getAbsolutePath();
    Now, in the output am getting the absolute path of the file as d:/XYZ/Filename. Is there any way to get the output as xxx.xx.x.x/XYZ/FileName ? Can someone please suggest why the server details are not fetched and instead the directory name is fetched.
    I am running the program to get absolute path of a file in my remote machine. and for accessing that remote file from my machine, I use xxx.xx.x.x/XYZ/FileName.
    Thanks in advance.

    I'm going to take it a step further and guess at what the OP is going to say next.
    On host w.x.y.z there's a file /a/b/share/some_dir/file.txt.
    Host w.x.y.z is sharing the /a/b/share/ directory as SHARE.
    Client mounts \\w.x.y.z\SHARE as D:, so that he sees D:/some_dir/file.txt.
    OP now wants to know not just that D:/some_dir/file.txt is \\w.x.y.z\SHARE/some_dir/file.txt, but also wants to know that on w.x.y.z, SHARE corresponds to /a/b/share.
    @OP: If that's what you want, forget it. Part of the premise of file common drive/directory sharing protocols is that the client does not know or care and does not need to know or care what the absolute path is on the serving host. It's none of his business.

Maybe you are looking for