title: Handle a file that can have suspicious macros when passed over HTTP request
body: <p>Suppose a user is trying to upload a file that contains macros to the server (I am using the Django server). How can I handle or check whether the file contains macros inside it without opening or writing the file to the server. I am using <a href="https://pypi.org/project/oletools/" rel="nofollow noreferrer">oletools</a> for detecting macros. </p>
  
  <p>The problem is, whenever a file is uploaded using the POST method, the URL is bound to a view "upload-doc". Inside the view I want to detect the macros. But as the file is still in HTTP request (not written to the server yet) the type of the file is "InMemoryUploadFile" which means I guess it is still in memory, not written to disk. </p>
  
  <p>Now, how can I detect the macros in this file which is not yet written to the disk? From <a href="https://bitbucket.org/decalage/oletools/wiki/olevba" rel="nofollow noreferrer">this</a> example on using olevba, I have to pass the file path for detecting macros, but as the file is in memory, I am getting "FileNotFound" error.</p>
  
  <p>Is there any way to detect macros in a file without accessing or writing to the server when it is uploaded using HTTP POST request?</p>
  
  <p>I am open to using any other package in achieving this. ANy suggestions can help me.</p>
  
  <p>Thanks in advance.</p>