Question

Uploading to Azure storage under a new filename


Badge

I'm looking for a way to upload to an azure file storage with a new filename. I eventually want to expose an FME server app that will allow the user to upload any raster file, and then will upload that file to the Azure Storage and call a few REST APIs afterwards. I have a basic workbench working on my machine that can implement the workflow.

 

The issue is, we can't have any spaces or periods in the filenames in the Azure storage, but I want to allow the user to upload rasters without changing the name. I have not found a way to be able to rename the file before or during the upload. I have experimented with using a Feature writer transformer with the File Copy writer to create a temporary file then using the temp file path in the Azure File Storage Connector but I'm struggling to even rename copies there.

 

I realize I could probably do hacky stuff like use a systemcaller to rename the file, but if I need to do that I'm not sure what the advantage of using FME is, since I could implement the workflow with only a few lines of Python without any need for hacky workarounds.

 

Anyone have any tips?


5 replies

Userlevel 6
Badge +33

The SystemCaller would be my suggestion, as this won't use unnecessary I/O.

Badge

The SystemCaller would be my suggestion, as this won't use unnecessary I/O.

Thanks for the suggestion! Do you know how this would translate to FME server? I'm testing on a windows machine but I know that eventually it will run on server. I guess one of my concerns with using that method is that I would have to tailor the syntax of the system calls for each system, right?

Userlevel 6
Badge +33

Thanks for the suggestion! Do you know how this would translate to FME server? I'm testing on a windows machine but I know that eventually it will run on server. I guess one of my concerns with using that method is that I would have to tailor the syntax of the system calls for each system, right?

You must make sure the fme server user is allowed to run the SystemCaller. Other than that, it just works.

Yes you can.

Using httpcaller you specify the name you'd like to give the file in the URL and in the body you specify which file(data) to upload. In the body you also specify the content type as this is not possible with the AzureBlobStorageConnector.

URL to use in httpcaller:

https://<your_account>.blob.core.windows.net/$web/<path><filename>?<shared_access_signature>

e.g. https://arcgisgkb.blob.core.windows.net/$web/GISDOC/Project/$(Projectcode)/Profiel/@Value(Profiel).png?sv=2020-10-02&st=2022-10-14T06%3A40%3A50Z&se=2023-12-15T07%3A40%3A00Z&sr=c&sp=racwdl&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

HTTPCaller

Badge

Yes you can.

Using httpcaller you specify the name you'd like to give the file in the URL and in the body you specify which file(data) to upload. In the body you also specify the content type as this is not possible with the AzureBlobStorageConnector.

URL to use in httpcaller:

https://<your_account>.blob.core.windows.net/$web/<path><filename>?<shared_access_signature>

e.g. https://arcgisgkb.blob.core.windows.net/$web/GISDOC/Project/$(Projectcode)/Profiel/@Value(Profiel).png?sv=2020-10-02&st=2022-10-14T06%3A40%3A50Z&se=2023-12-15T07%3A40%3A00Z&sr=c&sp=racwdl&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

HTTPCaller

This is exactly the solution I was looking for, thank you!

 

It would be nice if the AzureFileStorage connector could expose this functionality as well :)

Reply