Is it possible to upload or download .doc, .pdf or any image file to azure mobile services storage. If possible can anyone please provide me same samples.
if by storage you meant, Azure Blob Storage, yes.
here's some links :
Upload images to Windows Azure Storage by using Mobile Services
Upload File to Windows Azure Blob Storage using Windows Azure Mobile Services
Related
I need to upload a large file(up 4GB) using Blazor.
Please in your answers using the new version of Azure Storage SDK (v12 Azure.Storage.Blobs NuGet package.)
In my case, the old version will not work Azure Storage SDK (v11 WindowsAzure.Storage NuGet package.)
Requirement`
Upload file in Blazor UI
Send that file to the server side via API
Store that file in Azure Blob Storage on the server side.
I try a few ways to do this but I didn't manage it.
Is there any way to do this?
What I tried`
Send the file itself(2GB) to API but out of memory exception (google says do not do this way, bad practice)
2.Cut the file as chunks and send it to API, the first part of sending works but I can't collect them all together as one file and store it in Azure Blob Storage (I will have a memory issue).
If there is a way to store it in Azure Blob for example store the first part of chunks then update that file and write other parts sequentially in one file on Azure Blob not service memory. In the end, I will have one large file in Blob.
If there is a way to store it in Azure Blob for example store the
first part of chunks then update that file and write other parts
sequentially in one file on Azure Blob not service memory.
Yes. This is how Block Blobs work in Azure Storage.
Basically what you will need to do is send chunks (called blocks in Azure Storage) of the data to your API and directly save those chunks in blob storage using BlockBlobClient.StageBlockAsync. There is no need for you to save those chunks in your API. You will need to maintain the block ids of the chunks you are uploading in your Blazor application.
Once all the chunks (blocks) are uploaded, you will need to send the block ids to your API and will need to call BlockBlobClient.CommitBlockListAsync from your API to tell Azure Blob Storage to combine all blocks together to create a blob.
To learn more about creating block blobs by uploading blocks, you may find these links useful:
https://learn.microsoft.com/en-us/rest/api/storageservices/put-block
https://learn.microsoft.com/en-us/rest/api/storageservices/put-block-list
I am trying to upload more than 5 GB files in the azure blob in using blob.PutBlockAsync and blob.PutBlockListAsync in asp.net core but it gives me error blocks not contain more than 50000:
https://prnt.sc/10ntmn3
Could you please let me know how I can upload the large file on the azure blob in the asp.net core project?
I will have to accomplish this new task, to save images on Linux (Debian) server using ASP.NET Core 3. Any idea how to do that. What are the best practices? Any advice are welcome.
thnx
If the blob you mentioned is azure blob storage, you can take a look the following solutions as per your need.
1.If you want to use asp.net core save images to azure blob storage -> then from blob storage, save it to linux file system.
You can first install this nuget package Microsoft.Azure.Storage.Blob to your asp.net core, and refer to this link for saving images to azure blob storage via code(Note that this code is for this older package WindowsAzure.Storage, you need to modify a little). When the images are stored in azure blob storage, you can use blobfuse to map blob storage to your linux server.
2.If you just want to directly save images from asp.net core to linux server, then you should setup a ftp server in the linux server, then directly save images to that linux via ftp.
Hope it helps.
I am currently working on an UWP project where I need to take a photo using the device's camera before uploading it to my online service which is hosted on Azure.
How could I achieve this?
To upload photos to Azure, it's best to use Azure Blob Storage. Here's a link to the Quickstart guide as well as some sample code.
I have some files on Azure Storage eg
http://mywebsite.blob.core.windows.net/scans/1d251700-5457-49c6-abec-c70fa37f77dd.png
I am using MVC app as my api to process files etc.
To do what I want I need to create FileInfo object from the image.
Is it possible somehow using path as above?
You need to utilise the Azure Storage SDK in your application. This can be installed via nuget in Visual Studio. Once you have this installed you need to setup an access key to the blob storage location(s) you are reading and writing from and use the Storage client. There is a great how-to on the Azure documentation site.