I am a new bee to this .net MVC basically i am from PHP. I am trying to integrate web cam in my MVC app. I am using Flash to integrate it, I have written an action script to capture the image from web cam, but i am unable to upload it to DB. I tried with communicating javascript and and actionsctipt but its not working out for me. Any valuable inputs for me is appreciated
Plz help me anybody....... :(
Sameer Joshi
You'll need to post the file from your Flash applet to a .NET page / service / http handler / MVC Action which will actually write the image to your DB.
I would suggest simply posting the file to an appropriate action on an appropriate controller. An action along the lines of (assuming this is in the "Files" Controller)
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SaveFile(HttpPostedFile uploadedFile)
{
// write file to DB / save to disk here
RedirectToAction(......);
}
So from your Flash applet, you'd post the file to www.site.com/files/savefile
You may also check Silverlight 4 support for microphone and webcam.
Webcam and Microphone Showcase
George.
Related
I "just" need to do a simple https server in ASP.NET Core in order to receive some XML streams through a POST verb.
I just have to write these XML on hard disk.
I don't really know where to begin to just running an ASP.NET Core server to get the POST data.
Anyone could give me some inputs or a sample code ? I don't need MVVM or something else, just getting POST data.
Thanks :)
You can get a starter app by running the command
dotnet new webapi
That will give you all the code needed to set up a server that can accept REST API calls.
If you do not want to use the MVC model in ASP.NET Core, you can use the Razor Pages model. Please refer to this documentation https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-5.0&tabs=visual-studio. For Post Form data you will have to write a OnPostAsync method in you Razor Page.
I have the following situation:
There are two different projects in our solution:
asp.net mvc website
asp.net web api (service for mobile apps).
Users should have an ability to upload profile pictures from their mobile apps using mobile web api project. But the problem is that images are physically stored on different server at asp.net mvc website.
So here is the flow:
User uploads picture and sends it to mobileapidomain/api/user/uploadpicture. (base64)
Now I have to send this image to asp.net mvc site and store it on asp.net mvc server.
What is the best way to send current base64 string with image from web api controller into asp.net mvc project?
In such situation I think the best option would be to install within your mvc web application project packages for WebApi and make this project web application (normal usage) and web service at the same time. Then create new ApiController like this:
[HttpPost]
public IHttpActionResult UploadPicture(string base64)
{
// Do something with image
return Ok();
}
If you do not wish to install WebApi libraries there then I would suggest adding new regular Controller for uploading pictures and adding there similar action:
[HttpPost]
public void UploadPicture(string base64)
{
// Do something with image
}
If something goes wrong within the acton throw exception to inform peer that something wrong is going on. If the file is too long to send in one post I would suggest splitting it and concatenating within mvc application as it receives new portions of it.
I want to upload a video file using asp.net mvc . I am sending the file as postbody. How can this be retrieved later from the server using webservice. I have seen this example . Also this question helped me to understand it more. But I m not sure how to fetch post body.
But no sure how this works. How to do his properly in .net c#
In order for the file to be available later, you need to save it somewhere during the upload - either to a database or a folder on the server. Then, your web service needs to know how to retrieve it from that location.
I'm currently looking at the best way to upload an image to my existing WCF Json service, the service then saves the image to a folder on the server. Is it as simple as streaming the image? Or is there a different practice if you are using json?
Ultimately ill be sending an image from a mobile device to the service.
Found a good code over this place.
Have a look. It should cater your need. The code has both client and server implementation
MSDN
You could use ajaxForm or ajaxSubmit from http://www.malsup.com/jquery/form/
We used it to call an MVC action with our data, but had to use the iframe fallback option due to IE having issues with ajax and file inputs.
For a mobile site I would expect this to be useful.
For a mobile app I would expect it to be more a case of streaming the image as you would any other type of file.
Could someone please tell me/link me to how I could create a method similar to those posted below:
http://www.vimeo.com/api/docs/upload
http://www.flickr.com/services/api/upload.api.html
(I am providing the links as I'm not sure how to articulate this question without them!)
I'm using C# ASP.NET. IIS 6.
I have an existing web server with other public API methods. I do not want the iPhone user to have to open a web browser, and post to an aspx page. I want the iPhone developer to be able to call my method, and have one of the parameters be a handle to the file which gets POSTed.
Thanks in advance for any help.
You'll need to create a WCF Service Application. You can use this as a webservice that can be exposed to your clients. You can create a RESTful service using WCF where clients can POST video's to.
When searching for 'REST, API, WCF' you'll probably find all the resources you are looking for.