从Windows应用程序上传文件 [英] file upload from windows application

查看:61
本文介绍了从Windows应用程序上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个窗口应用程序,我的用户可以在其中将文件上传到Web服务器上.为此,我尝试了System.net.webclient

i want to develop a window application where my user can upload file on webserver. for this i tried System.net.webclient

//    try
//    {
//        System.Net.WebClient wc = new System.Net.WebClient();
//        wc.Credentials = new System.Net.NetworkCredential("id", "password");
//        wc.UploadFile("url,"filetoupload");
//    }
//    catch (Exception exx)
//    {
//        MessageBox.Show(exx.ToString());
//    }



但它不起作用.我从服务器收到404或405错误..plz帮助我完成任务..



but it does not work.i am getting 404 or 405 error from server..plz help me to accomplish task..

推荐答案

URL是否在服务器上存在?是什么让您相信所涉及的URL会接受您上传的文件?

从Google可以得知,很多人都做出了相同的基本假设,但我不知道这种方法将如何将文件上传到任何网页,一定会有对文档的不良记录该URL期望如何接收文件.

看起来 [
Does the URL exist on the server ? What makes you believe the URL in question is going to accept a file upload from you ?

From what I can tell from a google, a lot of people are making the same basic assumptions, but I don''t see how this method is going to upload a file to any webpage, there must be some sort of poorly documented expectation of how this URL expects to receieve a file.

It looks[^] like this method is for sending to an FTP site, which makes a lot more sense.


404表示未找到URL.
405表示您不允许做自己想做的事情.

在这两种情况下,都需要修改该站点或站点本身的IIS配置.如果您要上传修改后的网页(或脚本),那可能就是为什么要获取405.
404 means the URL was not found.
405 means you''re not allowed to do what you''re trying to do.

In both cases, you need to modify the IIS configuration for that site, or the site itself. If you''re trying to upload a modified web page (or script), that''s probably why you''re getting the 405.


这篇关于从Windows应用程序上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆