public void startUpload() throws InterruptedException
	{
		Random random = new Random();
		
		uploadWindow.statusLabel.setText("Loading image...");
		System.out.println(filePath);
		BufferedImage image = getBufferedImage(filePath);
		if (image == null) {
			uploadWindow.statusLabel.setText("An error occured!");
			uploadWindow.statusLabel.setForeground(Color.RED);
			uploadWindow.progressBar.setIndeterminate(false);
			return;
		}
		Thread.sleep(1500);
		uploadWindow.statusLabel.setText("Encoding image data...");
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		try {
			ImageIO.write(image, "png", baos);
			URL url = new URL(IMGUR_POST_URI);
			String data = URLEncoder.encode("image", "UTF-8") + "=" + URLEncoder.encode(Base64.encode(baos.toByteArray()), "UTF-8");
			data += "&" + URLEncoder.encode("key", "UTF-8") + "=" + URLEncoder.encode(IMGUR_API_KEY, "UTF-8");
			
			Thread.sleep(300 + random.nextInt(200));
			uploadWindow.statusLabel.setText("Connecting to Imgur...");

			URLConnection connection = url.openConnection();
			connection.setDoOutput(true);
			connection.addRequestProperty("Authorization", "Client-ID " + IMGUR_API_KEY);
			
			Thread.sleep(300 + random.nextInt(500));
			uploadWindow.statusLabel.setText("Uploading image...");
			OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream());
	        wr.write(data);
	        wr.flush();
	        
	        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
	        String response;
	        String responseURL = "";
	        while ((response = in.readLine()) != null) {
	        	String[] bits = response.split("\"");
	        	for (int i = 0; i < bits.length; i++) {
	        		if (bits[i].equals("link")) {
	        			responseURL = bits[i + 2];
	        		}
	        	}
	        }
	        System.out.println(responseURL);
	        in.close();
	        
	        Thread.sleep(250);
	        uploadWindow.statusLabel.setText("Upload complete!");
	        uploadWindow.progressBar.setVisible(false);
	        uploadWindow.label1.setVisible(true); 
	        uploadWindow.urlField.setVisible(true);
	        uploadWindow.urlField.setText(responseURL.replace("\\", ""));
	        uploadWindow.copyButton.setVisible(true);
	        if (Desktop.isDesktopSupported()) {
	        	uploadWindow.browserButton.setVisible(true);
	        }
		}
		catch (Exception e) {
			e.printStackTrace();
			uploadWindow.statusLabel.setText("An error occured!");
			uploadWindow.statusLabel.setForeground(Color.RED);
			uploadWindow.progressBar.setIndeterminate(false);
		}
	}