动态图像从PC上传到网站

编程入门 行业动态 更新时间:2024-10-22 07:39:38
本文介绍了动态图像从PC上传到网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在ASP.NET MVC 5中开发Web应用程序,其中一个想要在其上显示图像的Web。该Web表单应该像dropbox一样工作(如果我将图像放入我的PC文件夹,它可能会自动与我的网站合成)。我只是缺乏做这种事情。任何人请提出一个想法。

I'm Developing web application in ASP.NET MVC 5, One of the web from wants to show an images on it. That web form should work as like dropbox (If i put a image into my PC folder, it may automatically synthesize with my website). i'm just getting lack to do this type of thing. Any one please give an ideas.

推荐答案

你需要的是别的东西。它不是您网站的普通客户端,而是一个功能齐全的应用程序软件,可以管理您的文件系统,同时在服务器上记录您的文档和文件。 Dropbox应用程序在您的文件系统上创建一个要管理的文件夹。监视器会监视其中的所有文件。在实际中,(或在.NET中),您可以使用 FileSystemWatcher [ ^ ]确定何时在该目录中发生更改的对象。 我建议您阅读有关该课程的评论。 您的应用程序需要此对象,以便跟踪该目录或其中的文件发生的情况。然后,您可以执行不同的操作。例如,如果将新文件添加到文件夹,您可以将该文件传递到您的网站(或云?)。 HttpClient [ ^ ]将是一个非常完美的候选人(恕我直言)。 What you need is something else. It is not an ordinary client for your website, instead it is a full featured application software that manages your file system and at the same time keeps a note of your documents and files on the server. Dropbox application creates a folder on your file system to manage. All of the files in it are watched by a watchdog. In real, (or in .NET) you can use a FileSystemWatcher[^] object to determine when a change occurs in that directory. I recommend that you read the remarks about the class. Your application needs this object in order to keep a track of what happens to that directory or the files in it. Then you can perform different actions. For example if a new file is added to the folder, you can pass that file to your website (or cloud?). HttpClient[^] would be a very perfect candidate (IMHO). using (var client = new HttpClient()) { // get the location of that file // POST a multipart/form-data content }

可以在此主题中找到示例: stackoverflow/questions/18059588/httpclient-multipart-form-post- in-c-sharp [ ^ ] 最后,您需要处理请求并捕获内容并上传。一个很长的,但是...我相信如果你只是先将算法放在纸上,然后逐步编写源代码,你就可以完成它。

A sample for that can be found in this thread: stackoverflow/questions/18059588/httpclient-multipart-form-post-in-c-sharp[^] Then finally, you need to handle the request and capture the content and upload it. A long one, but... I am sure if you simply put the algorithm on paper first and then write the source code step-by-step you will be able to get it done.

更多推荐

动态图像从PC上传到网站

本文发布于:2023-10-12 17:11:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485348.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   动态   网站   PC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!