Results 1 to 7 of 7
  1. #1
    radhika123 is offline Member
    Join Date
    Apr 2008
    Posts
    4
    Rep Power
    0

    Default code to upload a file in java

    HI friends
    I want to know how to upload a file in java.
    After submitting the selected file should be copied in a folder created by us only.
    I mean first we need to select a file using browse,then after submitting the selected file should be placed in a folder ,this folder should be created by us only using mkdir();
    Can any one send me the code to upload a file.
    Thanks in advance

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    radhiks, did you search the Google. I hope you can find an example very easily. Have a try and see.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    If you're talking about uploading a file from a client's PC to a server, you'll need two pieces of code. One to run on the client's PC and one to run on the server. Sort of what FTP can do.
    There are several free FTP programs you could use.

  4. #4
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    No norm, What radhika wanted is to copy a file from 1 folder to another created by user in the same computer.

    As i remember we have a similar kind of post already with solutions too...
    She just has to do a search in different search engines with different keywords.
    To finish sooner, take your own time....
    Nivedithaaaa

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Niveditha View Post
    What radhika wanted is to copy a file from 1 folder to another created by user in the same computer.
    If so, simply use the file channels to copy files within a same PC in safer way. It's not much difficult at all.

  6. #6
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Eranga i meant to say copying files from one dir to other using java.
    To finish sooner, take your own time....
    Nivedithaaaa

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Niveditha View Post
    Eranga i meant to say copying files from one dir to other using java.
    Yes, Niveditha it's true. I got what you say. What I'm say is, easiest way to do it using Java is use of File Channel.

Similar Threads

  1. how to upload a file?
    By tommy in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 06-30-2008, 02:50 PM
  2. file upload
    By sundarjothi in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-27-2008, 11:52 AM
  3. file upload in java
    By muralikrishna in forum New To Java
    Replies: 6
    Last Post: 06-25-2008, 08:24 AM
  4. JFileUpload 2.0 released - Java file upload applet
    By jfileupload in forum Java Software
    Replies: 0
    Last Post: 03-09-2008, 02:04 PM
  5. File Upload
    By ShoeNinja in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-09-2007, 10:09 PM

Posting Permissions

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