@Override
  public void run() {
    try {
      if (privateFilesAccount.loginsuccessful) {
        userType = "reg";
        httpContext = privateFilesAccount.getHttpContext();
        sessionID = CookieUtils.getCookieValue(httpContext, "xfss");
        maxFileSizeLimit = 2147483648L; // 2 GB
      } else {
        host = "PrivateFiles.com";
        uploadInvalid();
        return;
      }

      if (file.length() > maxFileSizeLimit) {
        throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host);
      }
      uploadInitialising();
      initialize();

      long uploadID;
      Random random = new Random();
      uploadID = Math.round(random.nextFloat() * Math.pow(10, 12));
      uploadid_s = String.valueOf(uploadID);

      sess_id =
          StringUtils.stringBetweenTwoStrings(responseString, "name=\"sess_id\" value=\"", "\"");

      srv_tmp_url = uploadURL;

      uploadURL =
          StringUtils.removeLastChars(uploadURL, 3)
              + "cgi-bin/upload.cgi?upload_id="
              + uploadid_s
              + "&js_on=1&utype="
              + userType
              + "&upload_type=file";
      httpPost = new NUHttpPost(uploadURL);
      MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
      mpEntity.addPart("js_on", new StringBody("1"));
      mpEntity.addPart("upload_id", new StringBody(uploadid_s));
      mpEntity.addPart("upload_type", new StringBody("file"));
      mpEntity.addPart("utype", new StringBody(userType));
      mpEntity.addPart("sess_id", new StringBody(sess_id));
      mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url));
      mpEntity.addPart("file_0", createMonitoredFileBody());
      mpEntity.addPart("file_0_descr", new StringBody(""));
      mpEntity.addPart("link_rcpt", new StringBody(""));
      mpEntity.addPart("link_pass", new StringBody(""));
      mpEntity.addPart("to_folder", new StringBody(""));
      mpEntity.addPart("file_1", new StringBody(""));
      mpEntity.addPart("file_0_descr", new StringBody(""));
      httpPost.setEntity(mpEntity);

      NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
      NULogger.getLogger().info("Now uploading your file into PrivateFiles.com");
      uploading();
      httpResponse = httpclient.execute(httpPost, httpContext);
      responseString = EntityUtils.toString(httpResponse.getEntity());
      doc = Jsoup.parse(responseString);

      // Read the links
      gettingLink();
      upload_fn = doc.select("textarea[name=fn]").val();

      if (upload_fn != null) {
        httpPost = new NUHttpPost("https://www.privatefiles.com/");
        List<NameValuePair> formparams = new ArrayList<NameValuePair>();
        formparams.add(new BasicNameValuePair("fn", upload_fn));
        formparams.add(new BasicNameValuePair("op", "upload_result"));
        formparams.add(new BasicNameValuePair("st", "OK"));

        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
        httpPost.setEntity(entity);
        httpResponse = httpclient.execute(httpPost, httpContext);
        responseString = EntityUtils.toString(httpResponse.getEntity());

        doc = Jsoup.parse(responseString);
        downloadlink = doc.select("textarea").first().val();
        deletelink = doc.select("textarea").eq(3).val();

        NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink);
        NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink);
        downURL = downloadlink;
        delURL = deletelink;

        uploadFinished();
      }
    } catch (NUException ex) {
      ex.printError();
      uploadInvalid();
    } catch (Exception e) {
      Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e);

      uploadFailed();
    }
  }