Ejemplo n.º 1
0
        private static void QSPicUploadToFtp(string slbh, string base64Str, DOC_BINFILE doc_binfile)
        {
            FTPHelper ftpHelper = new FTPHelper();
            FTP       souFTp    = new FTP()
            {
                hostname = ConfigurationManager.AppSettings["FCFtpIP"],
                username = ConfigurationManager.AppSettings["FCFtpUser"],
                password = ConfigurationManager.AppSettings["FCFtpPWD"],
                port     = ConfigurationManager.AppSettings["FCFtpPort"],
            };
            FTP tagFTP = new FTP()
            {
                hostname = ConfigurationManager.AppSettings["FtpAddr"],
                username = ConfigurationManager.AppSettings["FtpUser"],
                password = ConfigurationManager.AppSettings["FtpPwd"],
                port     = ConfigurationManager.AppSettings["FtpPort"]
            };

            string tmpPath  = ConfigurationManager.AppSettings["TmpPath"];
            string yearDir  = slbh.Substring(0, 4);
            string monthDir = slbh.Substring(4, 2);
            string dayDir   = slbh.Substring(6, 2);
            string sortDir  = slbh.Substring(8);

            string path = ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir;

            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir, tagFTP))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir, tagFTP);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir, tagFTP))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir, tagFTP);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, tagFTP))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, tagFTP);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP))
            {
                try
                {
                    ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP);
                }
                catch { }
            }

            //if(!FTPHelper.DirectoryExist(path,tagFTP))
            //{
            //    FTPHelper.MakeDir(path, tagFTP);
            //}

            string source = tmpPath + "\\" + GetFileName(doc_binfile.FTPATH);

            CreateImgByBase64(base64Str, source);
            FileInfo fi = new FileInfo(source);

            doc_binfile.FTPATH = ftpHelper.UploadFtp("", source, path, tagFTP);
            fi.Delete();
        }
Ejemplo n.º 2
0
        private string UploadToFTP(string slbh, string source)
        {
            FTPHelper ftpHelper = new FTPHelper();
            FTP       souFTp    = new FTP()
            {
                hostname = ConfigurationManager.AppSettings["FtpAddr"],
                username = ConfigurationManager.AppSettings["FtpUser"],
                password = ConfigurationManager.AppSettings["FtpPwd"],
                port     = ConfigurationManager.AppSettings["FtpPort"],
            };
            string yearDir  = slbh.Substring(0, 4);
            string monthDir = slbh.Substring(4, 2);
            string dayDir   = slbh.Substring(6, 2);
            string sortDir  = slbh.Substring(8);

            string path = ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir;

            if (!ftpHelper.DirectoryExist(ftpDir, souFTp))
            {
                ftpHelper.MakeDir(ftpDir, souFTp);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir, souFTp))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir, souFTp);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir, souFTp))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir, souFTp);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, souFTp))
            {
                ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir, souFTp);
            }
            if (!ftpHelper.DirectoryExist(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, souFTp))
            {
                try
                {
                    ftpHelper.MakeDir(ftpDir + "/" + yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, souFTp);
                }
                catch { }
            }

            FileInfo fi     = new FileInfo(source);
            string   FTPATH = ftpHelper.UploadFtp("", source, path, souFTp);

            fi.Delete();
            return(FTPATH);
        }
Ejemplo n.º 3
0
        public static void UploadToFtp(string slbh, DOC_BINFILE item)
        {
            FTP souFTp = new FTP()
            {
                hostname = ConfigurationManager.AppSettings["FCFtpIP"],
                username = ConfigurationManager.AppSettings["FCFtpUser"],
                password = ConfigurationManager.AppSettings["FCFtpPWD"]
            };
            FTP tagFTP = new FTP()
            {
                hostname = ConfigurationManager.AppSettings["FtpAddr"],
                username = ConfigurationManager.AppSettings["FtpUser"],
                password = ConfigurationManager.AppSettings["FtpPwd"]
            };

            string tmpPath  = ConfigurationManager.AppSettings["TmpPath"];
            string yearDir  = slbh.Substring(0, 4);
            string monthDir = slbh.Substring(4, 2);
            string dayDir   = slbh.Substring(6, 2);
            string sortDir  = slbh.Substring(8);

            string path = yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir;

            if (!FTPHelper.DirectoryExist(yearDir, tagFTP))
            {
                FTPHelper.MakeDir(yearDir, tagFTP);
            }
            if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir, tagFTP))
            {
                FTPHelper.MakeDir(yearDir + "/" + monthDir, tagFTP);
            }
            if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir + "/" + dayDir, tagFTP))
            {
                FTPHelper.MakeDir(yearDir + "/" + monthDir + "/" + dayDir, tagFTP);
            }
            if (!FTPHelper.DirectoryExist(yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP))
            {
                FTPHelper.MakeDir(yearDir + "/" + monthDir + "/" + dayDir + "/" + sortDir, tagFTP);
            }

            //if(!FTPHelper.DirectoryExist(path,tagFTP))
            //{
            //    FTPHelper.MakeDir(path, tagFTP);
            //}

            string   source = FTPHelper.DownloadFtp(tmpPath + "\\" + GetFileName(item.FTPATH), "", item.FTPATH, souFTp);
            FileInfo fi     = new FileInfo(source);

            FTPHelper.UploadFtp("", source, path, tagFTP);
            fi.Delete();
        }