Uploading Images to a Website

Discussion in 'Plugin Development' started by SoThatsIt, Jun 5, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    SoThatsIt

    Hi, my plugin creates graphs of statistics that i need to upload to a website. How could i go about doing this, the graphs are created every 5 mins and are in the form of a BufferedImage or a png file where i saved the file.
     
  2. Offline

    Technius

    SoThatsIt
    You could use a FTP library to upload the files to your webserver.
     
  3. Offline

    SoThatsIt

    thanks for the suggestion, i have this code from a website
    Code:
    FTPClient client = new FTPClient();
            FileInputStream fis = null;
     
            try {
                client.connect(url);
                client.login("user", "password");
     
                String filename = "myPDF.pdf";
                fis = new FileInputStream(filename);
               
                client.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE);
                client.setFileTransferMode(FTP.BINARY_FILE_TYPE);
               
                client.storeFile("temp.pdf", fis);
                fis.close();
                client.logout();
            } catch (IOException e) {
                e.printStackTrace();
            }
    Would i need to do anything else than just this? or would i have to put something on the website and with the client.login(); what would i need to put in there

    Ok, now i have a noclassdeffounderror on the ftp classes FTPClient and FTP, do i have to add them next to serverstatistics.jar or the bukkit jar? or do i have to add it to my project some special way? i have added it as a library in my build path.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  4. Offline

    mike0631

    Hey take a look at this video.

     
  5. Offline

    Technius

    SoThatsIt
    You could load the library with a ClassLoader or you could have the library exported with your plugin.
     
  6. Offline

    SoThatsIt

    how would i go about doing this? i know you can do it with runnable jar files but am unsure how to do it with normal jar files.
     
  7. Offline

    Minnymin3

    Look up FatJar eclipse plugin. It allows you to export external jars with your jar file (doesn't matter if its runnable)
     
  8. Offline

    Technius

    SoThatsIt
    In the window as the build path in eclipse, go to order and export. Make sure that the library is selected.
     
  9. Offline

    SoThatsIt

    i did this but it still didnt work :eek:. I even opened the jar file to check if it was in there but it wasnt at all :( i will take a look at fat jar
     
  10. Offline

    lycano

    I would create a php script that creates the image and trigger this via an URL. if the webserer runs on the same machine as your mc server then you could limit access to localhost to disallow remote access to that file.
     
Thread Status:
Not open for further replies.

Share This Page