title: Not able to get the content in Uploaded file?
body: <p>I have taken the the code form the question given below:</p>
  
  <p><a href="https://stackoverflow.com/questions/13298140/how-to-upload-a-file-in-dart">How to upload a file in Dart?</a></p>
  
  <p>The Client Code </p>
  
  <pre class="lang-java prettyprint-override"><code>void main(){
       InputElement uploadInput = query('#uploadFile');
       uploadInput.on.change.add((e) {
       // read file content as dataURL
       final files = uploadInput.files;
       if (files.length == 1) {
                final file = files[0];
                final reader = new FileReader();
                reader.on.load.add((e) {
                       sendFile(reader.result);
                });
                reader.readAsText(file);
       }
    }); 
  }
  
  sendFile(dynamic data) {
      final req = new HttpRequest();
      req.on.readyStateChange.add((Event e) {
        if (req.readyState == HttpRequest.DONE &amp;&amp;
           (req.status == 200 || req.status == 0)) {
           window.alert("test successful");
        }
      });
      req.open("POST", "http://127.0.0.1:8080/upload");
      req.send(data);
      print(req.response);
  }
  </code></pre>
  
  <p>The Server code with minute changes as given below:</p>
  
  <pre class="lang-java prettyprint-override"><code>void UploadFile(HttpRequest request, HttpResponse response) {
       //some logic
       _readBody(request, (body) {
         var logFile = new File('test.txt');
         var out = logFile.openOutputStream(FileMode.WRITE);
         out.writeString(body);
         out.close();
         response.statusCode = HttpStatus.CREATED;
         response.contentLength = 0;
         response.outputStream.close();
       });
  }
  
  _readBody(HttpRequest request, void handleContent(String body)) {
       String contentString = ""; // request body byte data
       final completer = new Completer();
       final textFile = new StringInputStream(request.inputStream);
       textFile.onData = (){
                print("inside data");
                contentString = contentString.concat(textFile.read());
       };
       textFile.onClosed = () {
             completer.complete("");
       };
       textFile.onError = (Exception e) {
             print('exeption occured : ${e.toString()}');
       };
  
      // process the request and send a response
      completer.future.then((_){
             handleContent(contentString);
      });
     }
  </code></pre>
  
  <p>I dont know what is the error since I am unable to debug on console app in windows in dart editor.
  But I am not able to understand what is the error since My test file consist of no text that I sent from the uploaded file.</p>