Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Threaded View

  1. #1
    Member
    Join Date
    Sep 2019
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default in FTP check if folder exist, if not create the file. without using FTPClient Class only URL`S Class

    this is part of my code.

    * folder name - folder on my ftp server already exist

     
    			URL url3 = new URL("ftp://username:pass@host+folder name" + imageName + ".jpg");
    			URLConnection con3 = url3.openConnection();
    			ObjectOutputStream out3 = new ObjectOutputStream(con3.getOutputStream());
    			ImageIO.write(image, "jpg", out3);
    			out3.flush();
    			out3.close();
    			//end #6

    i have for each client, serial.
    i want to check for client that try to connected to ftp if foldernamed on is serial exist if not (first connection) to create the folder.

    i know thats can be done with FTPClient, but i think its not so hard without FTPClient (because i already read and write files).
    i just dont know how.

    please give very simple solution

    edit: another question, i try to delete file from my drive with file.delete() not working...
    and i can delete file from ftp without FTPClient ? thank you
    Last edited by doronbachar; October 26th, 2019 at 08:45 PM. Reason: i solve it

Similar Threads

  1. check whether the path is file or folder
    By viper_pranish in forum Java Theory & Questions
    Replies: 1
    Last Post: March 19th, 2013, 12:38 PM
  2. create a test class (main method) to start(run) the class in Java
    By curious725 in forum Java Theory & Questions
    Replies: 5
    Last Post: August 1st, 2012, 03:21 AM
  3. Can't create inner class object outside the outer class help needed?
    By Dark knight in forum Java Theory & Questions
    Replies: 2
    Last Post: July 31st, 2012, 02:34 AM
  4. Replies: 3
    Last Post: June 17th, 2012, 06:22 PM
  5. In a class create an array list of elements of another class, help!
    By LadyBelka in forum Collections and Generics
    Replies: 3
    Last Post: May 4th, 2011, 05:00 PM