예제 #1
0
        public bool UploadFile(string filename, string url)
        {
            bool result = false;

            lastErrorMessage = "";

            WebClientTimeOut wc = new WebClientTimeOut();

            wc.TimeOut = 360000;

            if (credentials != null)
            {
                wc.Credentials = credentials;
            }
            try
            {
                wc.UploadFile(url, filename);
                result = true;
            }
            catch (Exception e)
            {
                lastErrorMessage = e.Message;
            }

            return(result);
        }
예제 #2
0
        public bool DownloadFile(string url, string filename, int timeout)
        {
            bool result = false;

            lastErrorMessage = "";

            WebClientTimeOut wc = new WebClientTimeOut();

            if (credentials != null)
            {
                wc.Credentials = credentials;
            }

            wc.TimeOut = timeout;
            try
            {
                wc.DownloadFile(url, filename);
                result = true;
            }
            catch (Exception e)
            {
                lastErrorMessage = e.Message;
            }

            return(result);
        }