import org.apache.http.HttpEntity;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import http.requests.*;

boolean Upload(String url, PImage img) 
{
  String tempImageFilename = "tmp.png";

  String savePath = savePath("data/"+tempImageFilename);

  img.save(savePath);
  String filePath = dataPath(tempImageFilename);

  try 
  {
    DefaultHttpClient httpClient = new DefaultHttpClient();

    HttpPost  httpPost = new HttpPost( url );
    File upfile = new File( filePath );
    MultipartEntity mentity = new MultipartEntity();
    mentity.addPart("file", new FileBody(upfile));

    httpPost.setEntity(mentity);

    HttpResponse response = httpClient.execute( httpPost );
    HttpEntity   entity   = response.getEntity();

    println("----------------------------------------");
    println( response.getStatusLine() );
    println("----------------------------------------");

    if ( entity != null ) 
      entity.writeTo( System.out );
    if ( entity != null ) 
      entity.consumeContent();

    httpClient.getConnectionManager().shutdown();
  } 
  catch(Exception e) 
  {
    e.printStackTrace();
    return false;
  }
  return true;
}

void http_temp_value_post(String url, float tempVal, float voltVal, int digitalVal)
{
  PostRequest post = new PostRequest(url);

  post.addData("temp", str(tempVal));
  post.addData("volt", str(voltVal));
  post.addData("digit", str(digitalVal));

  post.send();
  println(post.getContent());
}