Is there any way to upload a PDF file that is on my local computer in a way where anyone can retrieve the PDF?
If I do something like
var filename = #"c:\test.pdf";
m.Attachments.Add(new Attachment(filename));
Anyone who goes onto the website has to have the same local path and same test.pdf file in the correct place (which would be impossible). So is there a way I can go about having to upload the pdf so it's not hard coded with a local path?
There are many ways to upload a file e.g. using an HTTP request and then download a file again using another HTTP request. If you just need to download files (no other API endpoints), consider using blob storage like AWS S3 bucket, Azure Blob Store or equivalents of other providers directly and configure the access rules in such a way that public read access is possible. To download the file in your program you then just need an instance of HttpClient and make a request to your blob store.
If you want to upload files through ASP.NET have a look at the Microsoft docs which describe all things to be considered in detail. You will still need to store the file somewhere when using this approach. Either on disk of the server you run the application on or again a blob store (and there are of course other possibilites).
Related
Please can you help me understand? Is it possible to use the Azure SAS URL to download Blob(all files) once from Azure Blob Storage into Browser?
I mean can the user click generated SAS URL and it will download all files into my Browser as a Folder?
The problem that I have some time I have very large files I make them ZIP and want to put them into Azure Blob storage and give the user URL to click and download it as Folder ZIP, not as file one by one.
Or if you have another suggestion please let me know, if there are some solutions to do code level I can do it via C#.
Any help will be appreciated.
I can't download the azure blob using sas URL. I'm new in this space, if you have another solution in this case or another way please let me know. Thank you :)
You could do this in 2 steps:
Firstly, run a program that takes all the files in a blob storage container and places them in a zip file, store that zip file in another container.
Then give the user a SAS URL to that file.
I am going to upload my files from local PC to OneDrive using c#, I would need how to check the file existance before upload them.
Please suggest any has algorithm which is using by One Drive.
I have tried to create XORHash but it different.
For my scenario, our current app is begin coded in html5 and angularjs communicating with web api. I have a workflow scenario that I seem to not be able to find an end to end example for. I would like to allow users of my website to upload videos and images to Azure Media Services. I found several examples that seem to move the data from a web page to blob storage and then copy over to azure media services.
Is there a way to upload the file directly to Media Services, instead of having a temporary and permanent blob container(one tied to AMS), as this approach seems to force me to have an additional storage container or is there a way to move the file to blob storage followed by linking the blob file to AMS via IAssetFile?
Can someone provide an end example that demonstrates the flow from web frontend upload to the file ending up in AMS?
Once up there, is there a way to make sure users can view but not download videos?
1.Is there a way to upload the file directly to Media Services:
The Media Services SDK requires you to first create an Asset object in our system. That Asset object is backed by a container in Storage. You can create an empty Asset object, and request a write only SAS URL (We call them "Locators" in our API) to upload your content directly into. You may want to check out this AngularJS module and see if it works. http://ngmodules.org/modules/angular-azure-blob-upload
2.Can someone provide an end example that demonstrates the flow from web frontend upload to the file ending up in AMS?
Your web API/frontend should use the Media Services SDK to create the empty Asset first. Once created, hand create a write only SAS URL and hand that back to your Angular client. The Angular client can then use client side javascript library to upload directly to the blob/container using the SAS URL and a module for azure-blob upload like the one here: http://ngmodules.org/modules/angular-azure-blob-upload
3.Once up there, is there a way to make sure users can view but not download videos?
Once the video is uploaded, you should Delete the Write only SAS "Locator" from your Asset's Locators collection. This way, nobody can use it to write again.
At this point you can create a Streaming Locator. Users will only be able to stream the file through our streaming services. Your file has to be encoded in a format that we can support streaming for, so you may have to first kick off an encoding job to get it into the right format and encoding settings (MP4 files with H264 and AAC audio). If you want to stream from Media Services, you need to make sure you have at least 1 streaming reserved unit enabled on your account. In addition, if you are looking to protect your files, you can take a look at our Content Protection services, which will provide on-the-fly AES 128 or PlayReady DRM encryption to your assets. You can integrate that with JWT tokens and Active Directory to authenticate/auth your users before they are able to decrypt the video on the client side.
I'm not too familiar with Azure Media Services but after looking at this guide http://azure.microsoft.com/en-us/documentation/articles/media-services-rest-get-started/ it appears to me that you can create an asset on Azure Media Services and link it to a blob. This means you'll only have one blob container.
AMS provides Rest API for all media processing capabilities including uploading, encoding, publishing. There is a sample project (postman collection) in GitHub to play around. This sample project is also accompanied by a well-written article. Please find the links below.
https://github.com/Azure-Samples/media-services-v3-rest-postman
https://learn.microsoft.com/en-us/azure/media-services/latest/stream-files-tutorial-with-rest
Hope this will help
I have one download URl,
How to download file from this url in c# Code . wp8 .
and This file may be store in external storage not be use isolated storage because file is so large Please Help
Use HttpClient for downloading files, see sample here.
Also, you must use IsolatedStorage since you don't have external storage available to you. Also, consider using Windows.Storage instead of IsolatedStorage.
How should I design my ASP.NET MVC application and database to cater for serving static content from Amazon's S3?
Presently I have an Images table for uploaded images on my local server. Each image has an ID and a local path to serve it from, but I want to move my static content to the cloud.
What do I need to store?
How do I serve S3 content via ASP.NET MVC 3?
Do I serve content via a cached web request, or directly from S3?
I've been running dedicated servers for a long time, but I'm still learning about best practices on the cloud.
AM is correct. If your images do not need to be secture you can just make your Bucket public and allow direct access from your application to the URL on S3.
However if you want to secure the files on S3 to authenticated user you can use URL signing and a timestamp described here http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html
So your URL will be something like
photos/puppy.jpg?AWSAccessKeyId=0PN5J17HBGZHT7JJ3X82
&Signature=rucSbH0yNEcP9oM2XNlouVI3BH4%3D
&Expires=1175139620
You can store the urls of those resources on S3 in your .net server and redirect requests to those urls. Just in the same way that you're currently storing the local path to images from the Images table.
Also when serving static images, you just need to use the S3 urls instead of urls from the .net server.
What you probably want to avoid is to have to load the file from S3 using your .net app and serve them as responses unless you really have a reason for doing so.