How to Save Files Temporarily in Azure Functions?

0
12
Asked By SkyBlueNinja37 On

Hey everyone, I'm facing a challenge with saving files to the Azure file system. We have a use case where we need to save files for a short time and then delete them. Locally, everything works well, and files are saved in the Files folder. However, once I deploy to Azure, I get an error saying "Invalid path, path not found." Is there a way to save files in the Azure file system? Thanks in advance!

3 Answers

Answered By CuriousCoder99 On

It sounds like you might want to rethink that approach. Generally, cloud environments like Azure aren’t meant for temporary file storage like a traditional server would be. It’s better to use Blob Storage for saving your files instead. Trust me, it’s the way to go!

StorageWizard42 -

Absolutely! Setting up Blob Storage is really straightforward and perfect for what you need.

TechSavvy14 -

Exactly! Blob Storage is ideal for short-term file storage. You can just upload and delete when you're done.

Answered By DevBee123 On

You need to make sure you're getting a temporary file path from the system. If you’re using .NET, you can use System.IO.Path.GetTempPath(). Keep in mind that local storage in Azure Functions is temporary, so files might not persist between executions. But for your use case, a durable location like Blob Storage for input/output is essential.

HappyDev72 -

Thanks for the tip! We tried using the temp path, and it works like a charm!

Answered By FileGuru88 On

You can indeed mount Azure Files, but I would suggest using temporary Blob Storage like some others mentioned. It’s a more robust solution for what you’re trying to achieve.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.