How to write file at server end?

Hi,
I use a af:inputFile component to receive uploaded files. And want to write files to the directory of server. However, when execute java.io.File.createNewFile(), it throw exception. How to resolve it?
import org.apache.myfaces.trinidad.model.UploadedFile;
import javax.faces.event.ValueChangeEvent;
import java.io.InputStream;
import java.io.File;
public class UploadFileHandler {
    public void doUpload(ValueChangeEvent event) throws IOException {
        File file = new File("C:\temp.txt");
        *file.createNewFile();* //Error happen here.
}

Hi Cheney,
It is good practice to use System.getProperty("file.separator") instead of hardcoding "/" or "\" .
Though your issue is resolved by using "//", you might want to consider changing to the above.
-Arun

Similar Messages

  • How to write file to server side?

    hello,
    Could anyone pls help me...
    I just want to see an example how can I write to a file that is placed at the server(save place as the applet).
    p.s. I have been successfully read a file from there...
    Suppose I have signed the applet (self-signed), anymore security problem I need to pay attention to?
    Thanks a lot!!

    hi mandy, from the applet u can send the file to be written into the server to a servlet running in server and the servlet can in turn write the file into the servlet. by applet - servlet communication, u can easily read and write files to the server.

  • How to write file to server using applet?

    Please help!!!!!!!!!!
    Why didn't this work?
    URLConnection ucon = url.openConnection();
                   ucon.connect();
                   ObjectOutputStream outStream = new ObjectOutputStream(new BufferedOutputStream(ucon.getOutputStream()));
                   outStream.writeObject(linkHolder);
                   outStream.close();
    .............As my applet run, the message printed out with my catch is: "java.net.UnknownSerivceException: Protocal doesn't support this output."
    However, the reading from server is fine:
    ObjectInputStream inStream = new ObjectInputStream(new BufferedInputStream(url.openStream()));
             links = (LinkHolder)inStream.readObject();
             inStream.close();
    ....I really appreciate for your help.
    JTom

    This file resides on server not local machine. I'm just testing on my local PC for now.
    By the way, applet doesn't allow any kind of communication to client machine or others, but only to the server it resides in; according to the specs.
    To get a url connection you need a server. You send
    the output to the server(some servlet or similar
    program running on server).
    But for file you don't need a server. You can open a
    file on your local machine if just have file
    permissions. There is no server involved here.

  • 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 questions regarding notes section , like how I write notes and they end up my my wife's phone !!!!!!

    I have questions regarding notes section , like how I write notes and they end up my my wife's phone !!!!!!

    Yes, as Josh P said, I can see that happening if you sync with iTunes on the same Computer and the same mail account.  Under the info section, advanced, I bet notes is checked for both of the devices..everything else might be un-checked, but notes might be checked for both devices...

  • How to transfer file from server to client

    I am making a server printer where all the system can take print out from the Printer installed on the server
    i am not able to send file from the client to the Server. I am Attaching the code Please Help me it is my college project.
    Server.java*
    import java.io.*;
    import java.lang.*;
    import java.net.*;
    import java.util.*;
    import java.io.File;
    class Server
         static final int PORT     = 26548; //Server Listening port
         static String path;
         public static void main(String args[])
              System.out.println("Starting Server");
              receive();
         public static void receive()
              while ( true )
                   try
                        //Create a socket
                        ServerSocket srvr = new ServerSocket(PORT);
                        Socket skt = srvr.accept();
                        String clientname= skt.getInetAddress().getHostAddress();
                        int clientport=skt.getPort();
                        long time = System.currentTimeMillis();
                        path= "C:\\Ankit Gupta\\Programs\\"+clientname+"\\"+time+" test.pdf";
                        System.out.println("File Recieved from : "+clientname+" : "+clientport);
                        //HttpServletRequest req;
                        //String remoteHost = req.getRemoteHost();
                        //String adr = getRemoteUser();
                        FileOutputStream fos = new FileOutputStream(path);
                        BufferedOutputStream out = new BufferedOutputStream(fos);
                        BufferedInputStream in = new BufferedInputStream( skt.getInputStream() );
                        //Read, and write the file to the socket
                        int i;
                        System.out.println("Receiving data...");
                        while ((i = in.read()) != -1)
                             out.write(i);
                        out.flush();
                        in.close();
                        out.close();
                        skt.close();
                        srvr.close();
                        System.out.println("Transfer complete.");
                        printfile();
                   catch(Exception e)
                        System.out.print("Error! It didn't work! " + e + "\n");
                   try
                        Thread.sleep(1000);
                   catch (InterruptedException ie)
                        System.err.println("Interrupted");
              } //end infinite while loop
         public static void printfile()
              delete();
         public static void delete()
              try
                   Thread.sleep(5000);
              catch (InterruptedException ie)
                   System.err.println("Interrupted");
              System.out.println("Deleting file");
              File f = new File(path);
         // Make sure the file or directory exists and isn't write protected
              if (!f.exists())
                   throw new IllegalArgumentException("Delete: no such file or directory: " + path);
         if (!f.canWrite())
                   throw new IllegalArgumentException("Delete: write protected: "+ path);
              // If it is a directory, make sure it is empty
         if (f.isDirectory())
                   String[] files = f.list();
                   if (files.length > 0)
                   throw new IllegalArgumentException("Delete: directory not empty: " + path);
         // Attempt to delete it
              boolean success = f.delete();
              if (!success)
                   throw new IllegalArgumentException("Delete: deletion failed");
    Client.java_
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class Client extends JFrame {
    static final int PORT = 26548; //Server Listening Port
    static File file;
    static final String HOST = "10.35.9.152";//Server Address     
    JTextField m_fileNameTF = new JTextField(25);
    JFileChooser m_fileChooser = new JFileChooser();
    Client() {
    m_fileNameTF.setEditable(false);
         JButton openButton = new JButton("Open");
         openButton.addActionListener(new OpenAction());
         JPanel content = new JPanel();
         content.setLayout(new FlowLayout());
         content.add(openButton);
    content.add(m_fileNameTF);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setContentPane(content);
         this.setSize(400,200);
    class OpenAction implements ActionListener {
         public void actionPerformed(ActionEvent ae) {
              int retval = m_fileChooser.showOpenDialog(Client.this);
              if (retval == JFileChooser.APPROVE_OPTION) {
                   file = m_fileChooser.getSelectedFile();
              m_fileNameTF.setText(file.getAbsolutePath());
                   send(file.getAbsolutePath());
    public static void main(String[] args) {
         JFrame window = new Client();
         window.setVisible(true);
         public static boolean send( String filename )
         try
              System.out.println("Connecting to Server");
              Socket skt = new Socket(HOST, PORT);
              //Create a file input stream and a buffered input stream.
              FileInputStream fis = new FileInputStream(filename);
              BufferedInputStream in = new BufferedInputStream(fis);
              BufferedOutputStream out = new BufferedOutputStream( skt.getOutputStream() );
              //Read, and write the file to the socket
              int i;
              System.out.println("Connected to Server");
              System.out.println("Sending data...\n");
              while ((i = in.read()) != -1)
                   out.write(i);
                   //System.out.println(i);
              System.out.println("Transfer complete.");
              //Close the socket and the file
              out.flush();
              out.close();
              in.close();
              skt.close();
              return true;
         catch( Exception e )
                   send(file.getAbsolutePath());
              return false;
    }

    I am making a server printer where all the system can take print out from the Printer installed on the server
    i am not able to send file from the client to the Server. I am Attaching the code Please Help me it is my college project.
    Server.java*
    import java.io.*;
    import java.lang.*;
    import java.net.*;
    import java.util.*;
    import java.io.File;
    class Server
         static final int PORT      = 26548; //Server Listening port
         static String path;
         public static void main(String args[])
              System.out.println("Starting Server");
              receive();
         public static void receive()
              while ( true )
                   try
                        //Create a socket
                        ServerSocket srvr = new ServerSocket(PORT);
                        Socket skt = srvr.accept();
                        String clientname= skt.getInetAddress().getHostAddress();
                        int clientport=skt.getPort();
                        long time = System.currentTimeMillis();
                        path= "C:\\Ankit Gupta\\Programs\\"+clientname+"\\"+time+" test.pdf";
                        System.out.println("File Recieved from : "+clientname+" : "+clientport);
                        //HttpServletRequest req;
                        //String remoteHost = req.getRemoteHost();
                        //String adr = getRemoteUser();
                        FileOutputStream fos = new FileOutputStream(path);
                        BufferedOutputStream out = new BufferedOutputStream(fos);
                        BufferedInputStream in = new BufferedInputStream( skt.getInputStream() );
                        //Read, and write the file to the socket
                        int i;
                        System.out.println("Receiving data...");
                        while ((i = in.read()) != -1)
                             out.write(i);
                        out.flush();
                        in.close();
                        out.close();
                        skt.close();
                        srvr.close();
                        System.out.println("Transfer complete.");
                        printfile();
                   catch(Exception e)
                        System.out.print("Error! It didn't work! " + e + "\n");
                   try
                        Thread.sleep(1000);
                   catch (InterruptedException ie)
                        System.err.println("Interrupted");
              } //end infinite while loop
         public static void printfile()
              delete();
         public static void delete()
              try
                   Thread.sleep(5000);
              catch (InterruptedException ie)
                   System.err.println("Interrupted");
              System.out.println("Deleting file");
              File f = new File(path);
             // Make sure the file or directory exists and isn't write protected
              if (!f.exists())
                   throw new IllegalArgumentException("Delete: no such file or directory: " + path);
             if (!f.canWrite())
                   throw new IllegalArgumentException("Delete: write protected: "+ path);
              // If it is a directory, make sure it is empty
             if (f.isDirectory())
                   String[] files = f.list();
                   if (files.length > 0)
                   throw new IllegalArgumentException("Delete: directory not empty: " + path);
             // Attempt to delete it
              boolean success = f.delete();
              if (!success)
                   throw new IllegalArgumentException("Delete: deletion failed");
    Client.java_
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class Client extends JFrame {
    static final int PORT = 26548; //Server Listening Port
    static File file;
    static final String HOST = "10.35.9.152";//Server Address     
    JTextField   m_fileNameTF  = new JTextField(25);
    JFileChooser m_fileChooser = new JFileChooser();
    Client() {
       m_fileNameTF.setEditable(false);
         JButton openButton = new JButton("Open");
         openButton.addActionListener(new OpenAction());
         JPanel content = new JPanel();
         content.setLayout(new FlowLayout());
         content.add(openButton);
      content.add(m_fileNameTF);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setContentPane(content);
         this.setSize(400,200);
    class OpenAction implements ActionListener {
         public void actionPerformed(ActionEvent ae) {
              int retval = m_fileChooser.showOpenDialog(Client.this);
              if (retval == JFileChooser.APPROVE_OPTION) {
                   file = m_fileChooser.getSelectedFile();
                 m_fileNameTF.setText(file.getAbsolutePath());
                   send(file.getAbsolutePath());
    public static void main(String[] args) {
         JFrame window = new Client();
         window.setVisible(true);
         public static boolean send( String filename )
         try
              System.out.println("Connecting to Server");
              Socket skt = new Socket(HOST, PORT);
              //Create a file input stream and a buffered input stream.
              FileInputStream fis = new FileInputStream(filename);
              BufferedInputStream in = new BufferedInputStream(fis);
              BufferedOutputStream out = new BufferedOutputStream( skt.getOutputStream() );
              //Read, and write the file to the socket
              int i;
              System.out.println("Connected to Server");
              System.out.println("Sending data...\n");
              while ((i = in.read()) != -1)
                   out.write(i);
                   //System.out.println(i);
              System.out.println("Transfer complete.");
              //Close the socket and the file
              out.flush();
              out.close();
              in.close();
              skt.close();
              return true;
         catch( Exception e )
                   send(file.getAbsolutePath());
              return false;
    }

  • How to upload file on server

    Hi every1,
    I have the following problem:
    I need to store information in files on server, how can I upload a file to a server into a specified directory??
    Tnx in advance,
    Mort

    //the server side
    ServerSocket acceptSocket = new ServerSocket(port);
    while(true) {
    Socket s = acceptSocket.accept();
    Connect(s);
    } // waits for client socket
    void Connect(Socket s) {
    in = new ObjectInputStream(s.getInputStream());
    } // you can create a file object on the client side and send it through an object stream. You should probably make sure that file objects are synchronized. They most likely are. I've never tried this, but there's no reason why it wouldn't work. Make sure to start the output stream before the input stream or you'll get a hang up.
    //the client side
    s = new Socket(InetAddress ip,int port);
    out = new ObjectOutputStream(s.getOutputStream());
    out.writeObject(File file); //write the file object to the output stream

  • How to view file on server.

    Hello
    I am developing a small client server application.Clients post comments about the application and these are stored in a file on the server.Its a standalone app.My question is if a client wants to view the file on server,how can i do that??
    Any help/suggestions will be appreciated.
    thanks
    Sree.

    I tried doing that but i get an exception
    java.net.SocketException: Software caused connection abort: socket write error .
    by google i found that this was due to a bug but has been fixed on JRE 1.5(i'm using JRE 1.6) but i still get this.
    here is my code:package com;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.MalformedURLException;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class TestServer_New
         public static void main(String args[])
              ServerSocket server = null;
              boolean listening = true;
              final String filename = "comments";
              try {
                   server = new ServerSocket(4321);
              catch (MalformedURLException e1) {
                   e1.printStackTrace();
              catch (IOException e) {
                   System.out.println("Error on port: 4321 " + ", " + e);
                   System.exit(1);
              System.out.println("Server setup and waiting for client connection ...");
              try
                   while( listening ) {
                        final Socket client_socket = server.accept();
                        System.out.println("Client connection accepted. Moving to local port ...");
                        new Thread( new Runnable() {
                             public void run() {
                                  write_to_comments(client_socket, filename);
                             }}).start();
                   server.close();
              catch (IOException e)
                   System.out.println("Did not accept connection: " + e);
                   System.exit(1);
         static synchronized void  write_to_comments(Socket client_socket , String filename) {
              try {
                   BufferedReader streamIn = new BufferedReader(new InputStreamReader(client_socket.getInputStream()));
                   BufferedReader file_reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
                   BufferedWriter server_file_writer = new BufferedWriter(new FileWriter(filename,true));
                   BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(client_socket.getOutputStream()));
                   String line ;
    //               while((line = streamIn.readLine()) != null){
    //                    if(!line.equals("view comments")){
    //                         server_file_writer.write(line);
    //                         server_file_writer.newLine();
    //                         System.out.println("write to comments request from client "+line);
    //                    else{
                             while ((line = file_reader.readLine()) != null){
                                  writer.write(line);
                                  writer.newLine();
                                  System.out.println("view comments request from client "+line);
                   writer.newLine();
                   writer.close();
    //               send_data_to_client(client_socket,filename);
    //               streamIn.close();
    //               client_socket.close();
              catch(IOException exception){
                   exception.printStackTrace();
                   System.out.println("IO Error in streams " + exception);
    }here is the client code
         void send_comments_to_server(){
              DataOutputStream output_stream;
              String host = "C001192097";     //server host name
              try {
                   Socket client = new Socket(host, 4321);
                   output_stream = new DataOutputStream(client.getOutputStream());
                   BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
                   BufferedWriter writer = new BufferedWriter(new FileWriter("commentsfromserver",false));
                   XStream xstream = new XStream_Data_Analyser();
                   String comment_report = get_title_text_field().getText();
                   Comments comment = new Comments();
                   User_Data user_data = new User_Data();
                   String user_info = "User Name: "+user_data.user_name+" "+"Host Name: "+user_data.host_name+" "+"Domain Name: "+ user_data.domain_name;
                   comment.user_info = user_info;
                   comment.summary = comment_report;
                   comment.comments = get_comments_text_area().getText();
                   String report = xstream.toXML(comment);
                   String line;
                   if (view_comments == true){
                        output_stream.writeBytes("view comments");
                        view_comments = false;
    //               else{
    //                    output_stream.writeBytes(report+"\n");
                   while((line = stream_input.readLine()) != null){
                             writer.write(line);
                             writer.newLine();
                             System.out.println("data received from server "+line);
    //               output_stream.close();
    //               stream_input.close();
    //               client.close();
              }catch (UnknownHostException exception){
                   System.err.println(host + ": unknown host.");
              catch (IOException exception){
                   System.err.println("I/O error with " + host);
                   exception.printStackTrace();
         }and this is the exception msg i get:
    java.net.SocketException: Software caused connection abort: socket write error
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(Unknown Source)
         at java.net.SocketOutputStream.write(Unknown Source)
         at java.io.DataOutputStream.writeBytes(Unknown Source)
         at data_analyser.Improvements_Dialog.send_comments_to_server(Improvements_Dialog.java:131)
         at data_analyser.Improvements_Dialog$2.actionPerformed(Improvements_Dialog.java:170)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    thanks for your help
    sree
    Edited by: sreecs on Sep 17, 2008 5:13 PM

  • How to write files to phweb share drive(phweb is nonsap system)

    Hi all,
             Is there any way to write files directly to phweb share drive(phweb is Nonsap system).
    Thanks,
    Balalji

    Hi Rob,
               Yaa I got .But how to use that function modules and when to use.I heard that first we have to write to presenation server and then we can use one of those function modules.Is it right?
    Thanks,
    Balaji

  • How to write files on Client Machine using JSP

    Hi,
    I am new to JSP. Please tell me how do i write files on Client machine thru a Browser.
    Please let me know at the Earliest.
    Thanks.
    Mehul Dave

    1) Well I find it rather convenient to deploy a web app as just one file rather than a bunch of files. For deployment it's much better. However I prefer using expanded files when developping (to use auto reload in Tomcat for example)
    2) It is a bad idea to upload files inside your webapp's context (ie: in it's deployment directory) because one day an uninformed system administrator might come and redeploy the web app and therefore delete all your uploaded files (believe me, I've already experienced this!)
    What i do usually is upload it in a completely different directory, something like /uploaded_files. Your uploaded files are therefore completely independant from your webapp
    However it is a bit trickyer to get those files back. Let's take the example of image uploads. You have 2 ways of proceeding:
    - the easiest : configure your web server (apache etc...) to redirect a certain url to your external directory. For example the /upload url will point to a /uploaded_files directory. This is easier to do and the fastest way to serve images but not always the best solution: you are dependant on the web server's configuration and you can't control the visibility on your files (no security constraints, anyone can see your uploaded files if they know the url).
    - you can also write a servlet which will load the file as an array of bytes and send it back in the response.
    You can call it this way :
    <img src="/serlvets/showmyimage?path=uploaded.gif">
    in this way you can control your uploaded files better: you may want to define security constraints on the visibity or not of uploaded files depending on the user which has logged on the site.

  • 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 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

  • How to write file in user's local desktop

    Hi,
    Using the WriteFile action, i can write the file in inetpub/wwwroot in server.
    Is there any way to write the file in user's local drive folder?
    Although now i am writing the file to server and allowing the user to access it through URL but I suspect that there could be user concurrent issue or file contamination issue.
    Constraint - The file should open with the default name.
    If i try to open a local copy to the user (thru SaveasCSV() or URL)  and allow the user to save the copy then the default name appear as Illumniator.
    Regards,
    Anil

    I think your current approach of saving to the web location and providing the user access via URL is the best approach.  From a security standpoint I can't see that writing directly to a user's desktop/laptop would be a good idea.
    If you are worried about naming or concurrency issues, then create sub folders that match their user name, or devise a naming convention that allows the objects to be unique between users and purpose.

  • How to write data at the end of doc in reverse order?[CS6-jsx]

    I need to move all my spec texts entries at et end of doc. To keep correct reference in all found entries i have to process in reverse order
    for (i = mFound.length-1; i>=0; i--){
    ...etc
    but can't to think up, how to place entries in write order at the end.
    String:
    mStory.insertionPoints.item(-1).select();
    app.paste();
    does not work properly (of course). It makes this:
    10.
    9.
    8.
    7.
    6.
    ...etc
    How to get
    1.
    2.
    3.
    4.
    ...etc

    Hi,
    I think what you are doing is the code below.
    you should fix using
    findGrep(true) => true is 'reverse order' option
    and move()
    var dummy = "Um veles 1.eatiorum et alic tem 2.quibusda nit volest, to corion conserum rem ipsanitate verores sequiduciat la demquis 3.inctorem ellestem reptis a et offic tem quidel earcide bissere mpellorerit ipsaecearios 4.volorrovid earchit omnitat atquatus aut quam nimet idelluptatum quis aut lam quo 5.ipsapiciis se simus autem fugias esto et et volupti to eum rem reius nobitatur aut evelis rae arumque lanihilicia sapitiam volorep ellupta volupta aut qui rendia doluptusam am necatur? Em aut abo. "
    var doc = app.documents.add();
    var tf = doc.textFrames.add({geometricBounds: ["10mm","10mm","100mm", "80mm"], contents:dummy});
    var st = tf.parentStory;
    var find_grep_obj = {
      findWhat : "\\d+\\.[^\\s]+"
    with(app.findChangeGrepOptions){
      includeFootnotes            = false;
      includeHiddenLayers         = false;
      includeLockedLayersForFind  = false;
      includeLockedStoriesForFind = false;
      includeMasterPages          = false;
      kanaSensitive               = true;
      widthSensitive              = true;
    var match = grep_find(doc, find_grep_obj);
    function grep_find(target_obj, find_grep_obj){
      app.findGrepPreferences = NothingEnum.nothing;
      app.findGrepPreferences.properties = find_grep_obj;
      var result = target_obj.findGrep(true); //=> reverse order [..., "3.inctorem","2.quibusda", "1.eatiorum"]
      app.findGrepPreferences = NothingEnum.nothing;
      return result;
    var i = match.length;
    while (i--) {
      st.insertionPoints[-1].contents = "\r";
      match[i].move(LocationOptions.AT_END, st);
    thank you.
    mg

  • How to write files to the filesystem with portal/plsql

    Hi,
    is there a way to write files to the filesystem via Portal?
    Or can i call an external programm (perl, php) to do so, while portal writes further information to database?
    thank you for the help
    Ralf Schmitt

    Hi Ralf,
    my primary task is to publish download-links to files stored ... somewhere as a linklist. I tried to store and download files to/from the database but i cant get it to run. Upload works, download doesn't.
    (i'm not talking about a single form-query-download-link! I need a report-like linklist)If you want to do this you'll have to write some code but sure it's possible - i did it myself.
    The links in the link list in your report should call a stored function retrieving the files from Wwdoc_document or whatever is the document table defined in your DAD. Simply select BLOB_CONTENT into a BLOB variable from the table, provided you know what file to read :-) The function would then read the BLOBs and send them to the client's browser via DBMS_LOB - it's poor design but it works just as smooth as it could and it's really performing. This would simply display the file into your browser or prompt for file save location, depending on what browser you are using and its client settings.
    I guess this is not so clear, if you want some more details feel free to e-mail me at [email protected]
    Another way would be to use wpg_docload to both download and upload files to/from the DB.
    Now i try to figure out if it is possible to store the files to the filesystem and write only additional info like description or path into db.Again, yes, it is. I can't recall exactly how I did it ^_^ but the trick is to create a virtual directory in the DB - pointing at a physical directory on the file system you want to write to, and you have to have full read-write permission on the directory itself, and its path must be included in the utl_file_dir database parameter. Then you use both COM Automation or UTL_FILE to write files.
    would it be possible to let a portal-form write info to the db and then pass the file to a php-script?
    regards,
    Ralf Schmitt

Maybe you are looking for

  • 3.0.9.8.3 Issues on Tru64

    Hey, I have just about managed to get the 30984 upgrade complete on a Tru64 instance of portal. However I do still have one invalid portal30 package. This package is causing any forms in portal to be unusable. The Package is wwa_api_module_event, whe

  • Reader 9.0 consumes 25% CPU and freezes...open Reader first?

    I was having problems double clicking on a document and scrolling through it. After a few page down clicks, it would consume 25% CPU and lock up. This is on a quad core with 6gb memory running 64 bit Vista. What I discovered was if I instead opened u

  • Can't download itunes or quicktime.

    (I have an ipod nano 6th gen.) I got on my itunes Tuesday 11/8/2011 and it said it saw that my ipod was connected but it couldnt read it on itunes. I looked all over the computer for an answer and nothing helped. Finally I came across one that told m

  • Inserting a column which starts with _

    Hi, I want to create a table with a column that begins with the _ character, but unfortuntly SQL*PLUS will not accept it. I checked and it seems that the _ character is a reserved oracle character for the LIKE operator. Is there anyway to start a col

  • To_number function return Invalid number

    Dear All, We have problem recently regarding one of our query that using to_number function. It worked smoothly for 4-5 years until recently our client complaints that the query is returning error ORA-01722: invalid number. This is the SQL Script ->