I have to create service that can get files from any authorized source and save them on file server. Then return back response with url for that resource.
The issue is that the service could be accessible from any web site or app. In case of Web site, what would be the best way to get file from a user and stream it to the service? Or do i have to save it to the web server first and then replay the stream to the service? I am thinking of creating Httphandler to channel traffic from web server (the instant file upload request is initiated by user) to the service. Would that be the best approach, or what would?
I have just implemented file transfer service for our internal use. It was a trivial service to implement that with WCF RESTFul way. What you need to do is to implement streaming over Http.
Actually, I have chosen new WCF Web Api to achieve this feature.
But if you are familiar with that, here you can see a good example on how you can implement this :
http://blogs.msdn.com/b/gblock/archive/2010/11/24/streaming-over-http-with-wcf.aspx
Related
I'm building a small web video player app for a school project. I'm using a C# Web Service, and an SQL server. My idea was to upload a video, then save its location and name at an SQL table and update the client accordingly.
I know that files can be uploaded through AJAX by sending formdata with XHR, but how do I actually receive them in the web service and save them in a designated path?
in case you'd like to implement a wcf service i think this article fits your needs
File Upload using WCF REST API and JavaScript
I've created a Hello World WCF service that uses the ASP.NET Development Server - I launch the client which opens a page in my web browser, HelloWorldService.svc, then this triggers the command prompt to open and print out a Hello World message.
I don't fully understand this chain of action or how it's useful.
I'm trying to create a WCF service that acts as a server that allows users to connect to the server and perform a file upload - I will take this file and store it locally on my machine.
For now, allowing this to work locally on only my PC is fine but I really don't know where to begin to accomplish this. Any advice would be appreciated.
EDIT: I NEED to use WCF. So please don't suggest alternative solutions.
WCF is arguably overkill. Simplest case, just use the standrad .Net FileUpload control.
Here are some examples:
ASP.NET File Upload
http://asp.net-tutorials.com/controls/file-upload-control/
Which leads to the question "When should I use WCF"? Here are a couple of answers:
When & where I should use WCF
http://forums.asp.net/t/1480028.aspx
http://msdn.microsoft.com/en-us/library/cc512038.aspx
http://forums.asp.net/t/1478962.aspx
Finally, here are a couple of links that describe WCF-based file transfer services:
http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
http://code.msdn.microsoft.com/windowsdesktop/Upload-files-using-a-REST-13f16af2
I have a WCF Service setup using BasicHttpBinding, now I need to make a section where I will allow users to upload a file. This needs to be secure, so we are thinking of using SSL for transfer from website to WCF. Does anyone know if I need to create another WCF Service just for the SSL piece or can it all be in one WCF Service, part of it being BasicHTTPBinding and the other part being the SSL piece, as we don't want to use SSL for all calls, just a few related to the file upload.
Otherwise is there anothe way to approach this? Like possibly encrypt the file via some encryption method on the website side and then send it over we could try that if that's recommended, so no SSL just sending the encrypted file to WCF to store on the server.
Thank you.
Yes you need 2 WCF services with seperate contracts, but they can be hosted onn the same site.
Configure the one that you want to use SSL with a binding that has "Transport Security".
I have a zip file and I have client application I need to send my files to web service how I can implement it easily ?
web service should have ability to store them on the server.
You can either do it the easy way just by passing an array of bytes to your web service like this or you can use a more complex way and send it as a FileStream (I have never tried the second way) like this.
I'm currently building a web page that will serve customers with files relevant for products they bought from us. The web server is located on a remote web host, but the files I want to serve are located on a local FTP server.
Right now the client logs on to the web host and, depending on its credentials on the web page, receives a file listing from the corresponding account on our local FTP server. The client can download the files because I'm directing the link directly to the FTP server. However, I want to change that so that it is the web host that is serving the file, not the FTP server (but I obviously don't want to store the files on the web host).
So, upon request the web app should fetch a certain file from the FTP server (using SSL, I might add) and then forward it to the client via HTTP (not SSL).
Also, it would be freaking awesome if the client can start receiving the file immediately from buffer while it is being fetched from FTP :P
How can I do it?
I am not sure of the reasons you want to do this since it unnecessarily adds a lot of intermediate layers and work, but if you still want to then use the FTP request client in .NET, buffer the file you want to serve and then simply open the response stream from your web application to serve this buffer directly via your web application.
It is a lot of unnecessary work for your web server instead of simply saving these files in a protected folder on the web server itself.