Howto upload file w/ applet and php/cgi script

Discussion in 'Java' started by Jorch, May 16, 2004.

  1. Jorch

    Jorch Guest

    Hello!

    I'm trying to make applet wich should have a possibility to upload
    file from client to server as like it's done in std html form's file
    element.

    How do i do it?? I know that it's something like:

    out.println("POST /cgi-bin/fileupload.php");
    out.println("Content-type: application/x-www-multipart-form-data"); //??
    out.println("Content-length: "+file_length+"\n\n");

    ....and then what??? How do I read data from file to output stream??

    Where do I find HOWTO to read about this subject???

    Thanx!

    -jori
     
    Jorch, May 16, 2004
    #1
    1. Advertising

  2. Jorch

    Roedy Green Guest

    On 16 May 2004 11:23:37 -0700, (Jorch) wrote
    or quoted :

    >How do i do it?? I know that it's something like:
    >
    >out.println("POST /cgi-bin/fileupload.php");
    >out.println("Content-type: application/x-www-multipart-form-data"); //??
    >out.println("Content-length: "+file_length+"\n\n");
    >
    >...and then what??? How do I read data from file to output stream??
    >
    >Where do I find HOWTO to read about this subject???


    the problem is you need some code on the server end to receive your
    file. You can't go fiddling with the server's files directly.

    See http://mindprod.com/jgloss/remotefileaccess.html

    To see how to do a post, see http://mindprod.com/jgloss/fileio.html

    As so see the MaxiFileTransfer class in
    http://mindprod.com/products.html#FILETRANSFER which does a PUT.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, May 16, 2004
    #2
    1. Advertising

  3. Jorch

    Jorch Guest

    >
    >the problem is you need some code on the server end to receive your
    >file. You can't go fiddling with the server's files directly.


    You don't say!

    I have code already, done with PHP and it works fine with HTML forms!

    Thing I would like to find out is how I can tell to server that file
    is coming, tell it's name to server and howto send the actual file to
    server (with PrintWriter or what??)

    -jori luoto
     
    Jorch, May 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland Poellinger
    Replies:
    1
    Views:
    1,301
    Ryan Dillon
    Mar 12, 2005
  2. Replies:
    3
    Views:
    856
    Oliver Wong
    Dec 5, 2006
  3. Rajive Narain
    Replies:
    0
    Views:
    1,902
    Rajive Narain
    Sep 18, 2009
  4. Koms Bomb
    Replies:
    2
    Views:
    126
    Koms Bomb
    Jul 2, 2004
  5. kath
    Replies:
    4
    Views:
    655
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page