0

I am using Azure Functions 3 to upload a zip file that I need to unzip on Azure Function temporary local drive for further processing. The function will process the files and they can be deleted after the function has finished running. Is there a best practice or an example how to upload a file to Azure Function?

doorman
  • 15,707
  • 22
  • 80
  • 145
  • 2
    the local storage should only be assumed to be temporary. What exactly do you need to do on it? – silent Feb 03 '20 at 10:37
  • 1
    why to upload file a file on local/temporary drive? – Sunny Sharma Feb 03 '20 at 10:52
  • 1
    just write a Http-triggered Function, send the file as the binary body of the HTTP message, store the content in memory (if not too big) and go from there?! – silent Feb 03 '20 at 11:15

1 Answers1

1

You shouldn't rely on the local drive in this case. It is meant to be used by the underlying platform and has limited capacity. In high scale conditions this could be a trouble.

For Free, Shared and Consumption (Functions) sites, there is a 500MB limit for all these locations together (i.e. not per-folder).

Ref: Understanding the Azure App Service file system

Better you upload your files (zip-file in your case) on a blob container. If you want to run the Azure function every time there a new file uploaded in a certain folder, you can have a BlobTrigger for your Azure Function.

Through the binding your Azure Function will run every time there's a new file uploaded and later you can decide to cleanup the zip file after processing.

You can refer to Azure Blob storage bindings for Azure Functions.

There's a handy article by Ramesh Podishetty on zip file processing in Azure Functions which you might find useful:

https://msdevzone.wordpress.com/2017/07/07/extract-a-zip-file-stored-in-azure-blob/

Dharman
  • 30,962
  • 25
  • 85
  • 135
Sunny Sharma
  • 4,688
  • 5
  • 35
  • 73
  • Hi @SunnySharma thanks for you reply. I wanted to upload the file directly into the function because then I could send a repsonse to the client when the processing is done. If the client uploads the file directly to the blob storage which triggers the Azure function for processing, do you know what would be the easiest way to notify the client once the processing is finished? – doorman Feb 03 '20 at 13:56
  • 1
    I guess email would be the best way here but it may differ as preferred. You can use SendGrid output binding for sending emails. Refer here: https://stackoverflow.com/q/43792755/1057667 – Sunny Sharma Feb 04 '20 at 07:45