Code example for FileEntity

0
		String file = localFilePath.substring(localFilePath.lastIndexOf('/')+1);
		file = URLEncoder.encode(file, "UTF-8");
		Log.d(TAG, "File to be created: " + file);
		 
		HttpPut put = new HttpPut(serverURI  + serverPath + fileFolderName + "/" + file);	
		put.setEntity(new FileEntity(new File(localFilePath), type));
				 
		put.addHeader("Content-type", type);
 
		DefaultHttpClient http = this.prepareHttpClient(user, pass);
		 
		Log.d(TAG, "HTTP MKCOL Request");
		HttpResponse response = http.execute(mkcol);
		StatusLine responseStatus = response.getStatusLine();	
		// debug 
		Log.d(TAG, "StatusLine: "
				+ responseStatus.toString() + ", "
				+ " URL: " + serverURI);
		 
		// evaluate the HTTP response status code 
		// ignore 405 (Method Not Allowed) for subsequent calls