Results 1 to 1 of 1
  1. #1
    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Default Uploading files to IIS from Applet

    Hi

    I am trying to upload a file using Applet to the IIS. Which is the best mechanism to do this ? I am from .NET background and got some sample codes, but getting 'Null pointer exception' . Can i get the some sample code to refer ? I am trying to invoke the applet (signed) in my asp.net application and upload file to the server.

    HttpURLConnection theUrlConnection = (HttpURLConnection) oUploadURL.openConnection();
    //theUrlConnection.connect();
    theUrlConnection.setDoOutput(true);
    theUrlConnection.setDoInput(true);
    theUrlConnection.setUseCaches(false);
    theUrlConnection.setConnectTimeout(10000);
    theUrlConnection.setRequestMethod("POST");


    theUrlConnection.setChunkedStreamingMode(1024);

    theUrlConnection.setRequestProperty("Content-Type", "multipart/form-data; boundary="
    + Boundary);

    theUrlConnection.setRequestProperty("Connection", "Keep-Alive");
    theUrlConnection.setRequestProperty("Keep-Alive", "header");


    DataOutputStream httpOut= null;
    // DataOutputStream httpOut = new DataOutputStream(theUrlConnection.getOutputStream( ));
    try
    {
    getout = theUrlConnection.getOutputStream(); (Here i am getting the error)
    httpOut = new DataOutputStream(getout);
    }
    catch(IOException eX)
    {
    eX.printStackTrace();
    }

    Regards
    Dominic
    Last edited by dominicthoppil; 05-30-2013 at 02:45 PM.

Similar Threads

  1. error in uploading files on remote host
    By imanesmaeili in forum Java Servlet
    Replies: 0
    Last Post: 02-06-2011, 12:45 PM
  2. Uploading in an ftp applet help
    By d4dirty in forum Java Applets
    Replies: 0
    Last Post: 01-07-2010, 09:24 AM
  3. Uploading files to server via HTTP
    By dan0 in forum New To Java
    Replies: 2
    Last Post: 03-13-2009, 06:27 PM
  4. uploading files
    By javaplus in forum Java Applets
    Replies: 1
    Last Post: 01-13-2008, 10:14 PM
  5. Uploading files to FTP
    By javaplus in forum New To Java
    Replies: 0
    Last Post: 12-19-2007, 10:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •