System.Net.WebClient.UploadFile C# (CSharp) Method

UploadFile() public method

public UploadFile ( System address, string fileName ) : byte[]
address System
fileName string
return byte[]
        public byte[] UploadFile(System.Uri address, string fileName) { throw null; }
        public byte[] UploadFile(string address, string method, string fileName) { throw null; }

Same methods

WebClient::UploadFile ( System address, string method, string fileName ) : byte[]
WebClient::UploadFile ( string address, string fileName ) : byte[]
WebClient::UploadFile ( string address, string method, string fileName ) : byte[]

Usage Example

Esempio n. 1
0
        private static void UploadToErpHostForSupport(string filename)
        {
            WebClient myWebClient = new WebClient ();
            try {

                myWebClient.QueryString ["COMP"] = ((GlobalvarsApp)Application.Context).COMPANY_CODE;
                myWebClient.QueryString ["BRAN"] = ((GlobalvarsApp)Application.Context).BRANCH_CODE;
                myWebClient.QueryString ["USER"] = ((GlobalvarsApp)Application.Context).USERID_CODE;
                if (filename.ToLower().Contains(".zip"))
                {
                    //upload zip db file and extract
                    byte[] responseArray = myWebClient.UploadFile (@"http://www.wincomcloud.com/UploadDb/uploadDbEx.aspx", filename);
                }else{
                    //upload db file
                    byte[] responseArray = myWebClient.UploadFile (@"http://www.wincomcloud.com/UploadDb/uploadDb.aspx", filename);
                }

            } catch {

            }
            finally{
                try{

                    File.Delete (filename);
                }catch
                {}
            }
        }
All Usage Examples Of System.Net.WebClient::UploadFile