diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
index cb8a8b42c71c6dfff824e26792ac8528bb5dd7a1..90a4e091a21d2d9ec86d1e427601e09981039ce3 100644
--- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
+++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
@@ -37,6 +37,7 @@ import java.io.InputStreamReader;
 import java.io.ByteArrayInputStream;
 import java.io.OutputStream;
 import java.io.BufferedInputStream;
+import java.io.FileOutputStream;
 
 import java.util.StringTokenizer;
 import java.util.Locale;
@@ -206,7 +207,39 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 			    e.printStackTrace(); // To clean up
 			}
 			params.setProperty( "content", new String( mess ) );
-		    }
+		    //CLD added for treating file uploading
+		    } else if ( mimetype != null && mimetype.startsWith("application/octet-stream") ) {
+			 
+			 
+         		File alignFile = new File(File.separator + "tmp" + File.separator + newId() +"XXX.rdf");
+
+         		// check if file already exists - and overwrite if necessary.
+         		if (alignFile.exists()) alignFile.delete();
+           
+               	 	FileOutputStream fos = new FileOutputStream(alignFile);
+            		InputStream is = request.getInputStream();
+			
+           	        try {
+                
+               			byte[] buffer = new byte[4096];
+				int bytes=0; 
+               			while (true) {
+                  			bytes = is.read(buffer);
+                  			if (bytes < 0) break;
+                  			fos.write(buffer, 0, bytes);
+               			}
+
+               			fos.flush();
+				fos.close();
+            		} catch (Exception e) {}
+
+               		is.close();
+			 
+			params.setProperty( "content", "" );
+
+			params.setProperty( "filename" ,  alignFile.getAbsolutePath()  );
+			
+         	    } 
 
 		    // Get the answer (HTTP)
 		    Response r = serve( uri, method, header, params );
diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
index a2b6b1a59550e48d9b13928e1de758d61a2be5bb..7411f32aca811ec77e6d76ca1bf674bbae489529 100644
--- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
+++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
@@ -203,12 +203,14 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	// Create the DOM tree for the message
 	Document domMessage = null;
 	try {
+		 
 	    domMessage = BUILDER.parse( new ByteArrayInputStream( message.getBytes()) );
 	    // DECIDE WHAT TO DO WITH THESE ERRORS
 	    // CERTAINLY RETURN A "CANNOT PARSE REQUEST"
 	} catch  ( IOException ioex ) {
 	    ioex.printStackTrace();
 	} catch  ( SAXException saxex ) {
+	    //System.err.println(" BUILDER problem.");
 	    saxex.printStackTrace();
 	}
 
@@ -391,16 +393,26 @@ public class WSAServProfile implements AlignmentServiceProfile {
 
 	    getParameter( domMessage, message, params, "url", "url" );
 	    if ( params.getParameter( "url" ) == null ) {
-		getParameter( domMessage, message, params, "content", "content" );
-		if ( params.getParameter( "content" ) == null ) {
-		    answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
-		} else {
+
+		//CLD added
+		//This code used to initialize "content". 
+		//It is not necessary any more when "content" is stocked in a file
+		//getParameter( domMessage, message, params, "content", "content" );
+
+		//params.setParameter( "content",  message);
+		//"filename" is stored in "HTMLAServProfile"
+
+		params.setParameter( "filename",  param.getParameter( "filename" ) );
+
+		//if ( params.getParameter( "content" ) == null ) {
+		//    answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
+		//} else {
 		    // Save the content as a temporary file (gensym)
 		    // Set the URI as the file:// uri for that file
 		    // Set it in the "url" parameter
 		    // Call load as below
 		    // Take care somehow to discard the temporary file
-		}
+		//}
 	    }
 	    if ( answer == null )
 		answer = manager.load( new Message(newId(),(Message)null,myId,serverURL,"", params) );