question

JAPNAMSINGH-6684 avatar image
0 Votes"
JAPNAMSINGH-6684 asked JAPNAMSINGH-6684 commented

Azure functions -How to get filename based on http trigger and sending binary file

Hi Team,

I am working on azure functions(http trigger based), is there an way to grab the filename on posting binary file..I can get content type, length but I need the filename.

Thanks

azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered JAPNAMSINGH-6684 commented

@JAPNAMSINGH-6684 If you are posting bytes directly to the endpoint, there would be no way to get the filename since that is something that is present in the underlying filesystem and not really the file itself.

Instead, you could opt to make a multipart request or simply include the filename in a HTTP header of the request.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PramodValavala-MSFT ok, When I do multipart request , the word file(content type ="text/plain") is getting corrupted on uploading to SharePoint site using graph api

0 Votes 0 ·

@JAPNAMSINGH-6684 Could you confirm if you are parsing the multipart request before uploading to SharePoint? Also, you could dump the bytes into a file (blob storage or local) to test.

0 Votes 0 ·

@PramodValavala-MSFT Thanks for your help I was able to upload based on form-data and get filename I used the graph sdk way

0 Votes 0 ·