How to copy file from server to another machine in network through JSP

Hello!
any body can solve my problem.
i m working in JSP. i want to copy a file from server on which JSP engine is running to another computer in the same network.
i used Java File Object to copy file from one machine to another in network. and its working fine on network. but the problem is when i used the same code in web page there is exception which is Access is Denied. what i should do now.
i m writing the code i m using in my JSP page
String fileToCopy = "C:/oracle/Apache/Apache/htdocs/FAO/FAO_MiddleFrame.jsp";
     String destinationDir = "\\\\af09\\c";
File source = new File(fileToCopy);
String fileName1 = source.getName();
if ((!destinationDir.endsWith("\\")) && (!destinationDir.endsWith("/"))) {
destinationDir = destinationDir + "\\";
File destination = new File(destinationDir + fileName1);
if (!destination.exists()) {
if (!destination.createNewFile()) {
//throw new IOException("Unable to create file. May be you don't have permissions.");
byte[] buffer = new byte[1024];
FileInputStream in = new FileInputStream(source);
FileOutputStream outStream = new FileOutputStream(destination);
int bytesRead = 0;
while ((bytesRead = in.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
out.println("File copied successfully ....");
plz reply me as soon as possible.
i will be very thankful
Saad

Thats the way it works. Cause servlet contaner doesnot allow other machines in the network to access other than machine which it came from as in case of applets. What you can do is if the other machine is also based on webserver or app server .. you can upload the file as it gets to that page do the process.
I would like to hear more on my comments..
Suggestions ??
Ban

Similar Messages

  • How to copy files from TC to another TC with ethernet

    Hello. I bought a new 3 TB Time Capsule and I need to transfer almost 2 TB in files from my old Time Capsule. Using wireless says it will take more than a week... is there any other option? maybe ethernet? or do you know a faster way to do that? I've searched over the web and found some people talking about ethernet but they didn't explain.
    thanks

    The copy is always via the computer.. so you want to plug the old TC into the new one by ethernet.. wireless off on the old TC..
    Plug the computer into the new TC, wireless off on the computer.
    Now copy the files.. this will not be fast due to the double handling of the files, but it will better than wireless by 3-5days.

  • How to save file from server to client machine

    Hi,
    By using POI library i'm writing values to the existing excel sheet which is available in server. After i written values to the excel, i want to save the same file to the client machine.
    How to achieve this.
    I googled about this, but still i didn't get any clear idea.
    Thanks in advance,
    SAN

    Sameera,
    No, i can't understand what is the meaning of the following code:
    public void doDownload(FacesContext facesContext, OutputStream outputStream) {
    // write the neccessary code to get the download data from the Model
    String data = getDownloadData();
    // save to the output stream
    try {
    OutputStreamWriter writer = new OutputStreamWriter(outputStream,"UTF-8");
    writer.write(data);
    writer.close();
    outputStream.close();
    } catch (IOException e) {
    // handle I/O exceptions
    can you please explain this code little more.
    Edited by: san-717 on Feb 29, 2012 2:30 PM

  • How to copy file from application server

    Hello experts,
    How to copy file from one folder of application server and paste it to other folder of application server(application server is same)?
    Is there any function module exists???
    thanks in advance
    Saurabh

    Hi you can use this function module to move a file from application server to another folder on application server.
    call function 'WS_FILE_COPY'
               exporting
                    destination = m_destination
                    source      = m_source
               importing
                    return      = return.
    Plus u can use this function module to delete the file from that folder from which u want to replace it.
          call function 'WS_FILE_DELETE'
               exporting
                    file   = m_source
               importing
                    return = return.
    The above FM can help u copy a file from one folder to another and delete the file from that folder.

  • How to copy files from a color classic w/broken floppy drive to an i-book ?

    How to copy files from a color classic w/broken floppy drive to an i-book ?
    I have a Coplor Classic with a system 7.
    There is no ethernet on color classic. The floppy drive is dead.
    I need some important files I have on the color classic...
    How do I connetct them to transfer files?...

    The easiest way, as AppleIIFreak has suggested, is probably to find another older Macintosh computer (with the round MiniDIN printer port) to be used as an intermediary. You could then connect the two machines by means of LocalTalk cabling, or just a plain Mac serial printer cable between the printer ports, and then set up file sharing. From that other Mac, you should be able to forward the files via Ethernet, diskettes (if you have an external USB floppy drive for the iBook) or email (Internet).
    If a second old Mac is not available, you may want to try something else. It would not be unusual for a Color Classic to have ClarisWorks already (obviously, one cannot expect anything new to become installed). If so, that program suite would contain a communications part. This means that you could connect an external serial modem, and send the files over the phone lines (or locally, modem-to-modem, in principle as in KB article # 22229; sometimes a very simple home-built line simulator may have to be added) to any other computer using a terminal emulation application with file transfer capabilities. It would also be possible to connect the modem port directly to the serial port of a PC, through a combination of a Mac modem cable (MiniDIN-8M to DB-25M) and a standard PC null-modem cable (DB-25F to DB-9F).
    Jan

  • How can i transfer files from forms10g to another machine..?

    Dear All,
    We would like to transfer image files from forms10g to another machine rather than Application server using webutil,
    Can any body give me a workaround for the same, because its occupying more space in the application server, so it would be better if we can able to transfer to another networked machine..
    Thanks in advance
    Thangaraj

    Actually we are not mapping machine name something in webutil.cfg file. We just need to specify the path that from where we will transfer the file from application server to client. And the time time of transfer the path you will
    choose for client webutil will transfer the file on that location automatically.
    -Ammad

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

  • I have macbook pro 13" I want to know how to copy files from my mac to the external Toshiba Hard Drive. I can't even delete files from my external hard drive. please help me my macbook HD is almost full and I have to copy my images to the Toshiba HD

    I have macbook pro 13" I want to know how to copy files from my mac to the external Toshiba Hard Drive. I can't even delete files from my external hard drive. please help me my macbook HD is almost full and I have to copy my images to the Toshiba HD

    To delete files from your external HDD, attach it to your MBP and drag the unwanted files to trash and then empty trash.
    Then you select the files that you want to transfer by 'drag and drop' to the external HDD and trash the files on your MBP.
    Ciao.

  • Out of disk space when copying files from server to server

    Servers: NW 5.1.7
    Workstation: Windows 98SE with client32 v3.4
    There is a batch file that copies files from server A to server B. At certain point, the copying gets stuck and message is displayed on the workstation: ""Network Status. Client32: out of disk space writing file to server B." Unless I press OK, the copying will not continue. There's plenty of space and memory, no quotes or user restrictions on server B. This procedure worked for years without any problem and nothing was altered on the servers or workstation at time of occurrence.

    Did you purge the volumes ?
    How high is ratio between compressed and noncompressed data on volumes?
    I assume, that for this usage (copy one server to another) you should
    seek the different way (program), which transfer the compressed data
    with untouched state of compression.
    Jindrich Kovar
    Marty Fox napsal(a):
    > Servers: NW 5.1.7
    > Workstation: Windows 98SE with client32 v3.4
    > There is a batch file that copies files from server A to server B. At certain point, the copying gets stuck and message is displayed on the workstation: ""Network Status. Client32: out of disk space writing file to server B." Unless I press OK, the copying will not continue. There's plenty of space and memory, no quotes or user restrictions on server B. This procedure worked for years without any problem and nothing was altered on the servers or workstation at time of occurrence.

  • How to read file from server if I have a logical file path?

    Hi guys,
    I'm having a pretty "on the run" question,
    My program is currently reading a file from server using "open dataset" with file path like this (just example)
    /usr/interface/abc/bcd/testfile.dat
    Now I got a requirement to make it more consistent to read files, instead of reading that physical file name, I should read the files from a specific folder using logical path.
    So I go to T code "FILE" and created a logical path called ZABC_FILE_PATH, unix compatible, with physical path is (for example),
    /usr/interface/<sysid>/<client>/<filename>
    My question is, can I still use open dataset statement to read this? if yes, how do I do that? If no, there should be alternative way, please let me know what you think. Thanks,

    Thanks all, I figured it out.
    ONe thing is that typo double quote
    The other thing is the importing part, I need the full file path.
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
      EXPORTING
        CLIENT                           = SY-MANDT
        logical_path                     = 'ZABC_MY_LOGICAL_FILE_PATH'
    *   OPERATING_SYSTEM                 = SY-OPSYS
    *   PARAMETER_1                      = ' '
    *   PARAMETER_2                      = ' '
    *   PARAMETER_3                      = ' '
    *   USE_BUFFER                       = ' '
        file_name                        =  v_1
    *   USE_PRESENTATION_SERVER          = ' '
    *   ELEMINATE_BLANKS                 = 'X'
      IMPORTING
        FILE_NAME_WITH_PATH              = v_what_I_need
    * EXCEPTIONS
    *   PATH_NOT_FOUND                   = 1
    *   MISSING_PARAMETER                = 2
    *   OPERATING_SYSTEM_NOT_FOUND       = 3
    *   FILE_SYSTEM_NOT_FOUND            = 4
    *   OTHERS                           = 5
    I really appreciate your contributions, thanks again!

  • How to read file from server

    Hi,
    When i try to read file from server,the following message is displayed .
    ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /tmp read) has not been granted to EWMTRACKTEST. The PL/SQL to grant this is dbms_java.grant_permission( 'EWMTRACKTEST', 'SYS:java.io.FilePermission', ' /tmp', 'read' )
    ORA-06512: at "EWMTRACKTEST.GET_DIRLIST_EWM", line 1
    ORA-06512: at line 1
    thanks and regards
    P Prakash

    it seems obvious, user EWMTRACKTEST doesn`t have access to directory /tmp and the file under that.
    try to give read permission and try again.
    you could use command line like 'chmod' to grant permissions.

  • How to export XML from server to local machine

    Hi all
    i want to export some XML files from instance to my local machine.right now i m i have Ftpied the files from server to to my local machine but ,but it is not coming with personalization .
    thanx in advance
    Pratap

    Hi Paratap,
    If you want to see source of the page use
    call jdr_utils.printDocument('/oracle/apps/pos/orders/webui/PosVpoMainPG');
    If you want to see the personalization for the source use
    call jdr_utils.printDocument('/oracle/apps/pos/orders/webui/customizations/site/0/PosVpoMainPG');
    I have given these examples for site level personalization, depanding upon the personalization level the path may vary.
    You can also export the files using XMLExporter by giving appropriate path.
    You can FTP all other source files from the server.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to copy file from one table to another table at another database

    I need to transfer my tables from one workspace and schema to another workspace and schema. Basically I need to create again all the tables at this new schema. How could I transfer data from tha table at old schema to the table at new schema when this table has files stored in it? (data type is blob)
    thank you so much,
    Silver

    Hello Silver,
    Depending which database you're using (if it's available) I would recommend to use datapump.
    Datapump allows you to copy an entire schema to another database, it's the "new" export/import you might now.
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    REWARDS: Please remember to mark helpful or correct posts on the forum

  • How to copy file from  one location to another

    Hi,
    I am new to java, I tried the following code to move the file from one location to another
    public class CopyFiles {
    public String copy ( File source, File target)
    throws IOException {   
    FileChannel sourceChannel = null;
    FileChannel targetChannel =null;
    try {   
    sourceChannel =new FileInputStream(source).getChannel();
    targetChannel= new FileOutputStream(target).getChannel();
    targetChannel.transferFrom(sourceChannel, 0,
    sourceChannel.size());
    finally {   
    targetChannel.close();
    sourceChannel.close();
    return "Success";
    public static void main(String [] args) throws Exception{   
    File source = new File("C:\\users\\download.pdf");
    File destinationFile = new File("C:\\apple\\download.pdf");
    copy(source, destinationFile);
    The above code is working perfectly, but I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.

    kameshb wrote:
    I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.It's not totally clear what you're saying here, but what I think you mean is that you don't want to explicitly set the destination file name--you want to just give the copy the same name as the original. Yes?
    If that's the case, then break the original up into separate directory and file name portions, and then construct the destination path from the destination directory plus original file name. You can do that by manipulating the full path string, or by using the methods in java.io.File.

  • How to copy files from one user to another on same macbook pro

    I used the migration assistant to move files from an old windows pc to my new macbook pro.  It created a second user and put everything there.  I now can't figure out how to move them so they are under me.

    Welcome to Apple Support Communities
    The easiest way is to put your files in /Users/Shared. To access to this folder, open a Finder window, select the Go menu (on the menu bar) > Go to Folder, and type that directory.
    That folder can be read by all users, so you won't have any problem to copy your files to the other user account.
    Another option would be to copy your files to an external drive. Also, see > https://discussions.apple.com/docs/DOC-5472

Maybe you are looking for