Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload files to FTP server
#1
Bug 
Sending files to an FTP server, you can use your PC to send logs to a computer with the VPS.
PHP Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using Addon;

namespace 
FTP
{
    public class 
Class1 CPlugin
    
{
        public 
override void OnServerLoad()
        {
            var 
filename "plugins//log.txt";
            
string ftpServerIP "127.0.0.1";
            
string ftpUserID "admin";
            
string ftpPassword "12345";
            
string ftpPath "/public_html/";
            
FileInfo fileInf = new FileInfo(filename);
            
string uri "ftp://" ftpServerIP ftpPath fileInf.Name;
            
FtpWebRequest reqFTP;
            
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" ftpServerIP ftpPath fileInf.Name));
            
reqFTP.Credentials = new NetworkCredential(ftpUserIDftpPassword);
            
reqFTP.KeepAlive false;
            
reqFTP.Method WebRequestMethods.Ftp.UploadFile;
            
reqFTP.UseBinary true;
            
reqFTP.ContentLength fileInf.Length;
            
int buffLength 2048;
            
byte[] buff = new byte[buffLength];
            
int contentLen;
            
FileStream fs fileInf.OpenRead();
            try
            {
                
Stream strm reqFTP.GetRequestStream();
                
contentLen fs.Read(buff0buffLength);
                while (
contentLen != 0)
                {
                    
strm.Write(buff0contentLen);
                    
contentLen fs.Read(buff0buffLength);
                }
                
strm.Close();
                
fs.Close();
            }
            catch (
Exception ex)
            {
                
ServerPrint("[FTP Status]: " ex.Message);
            }
        }
    }

Reply

#2
(01-27-2016, 20:17)S3VDIT0 Wrote: I think everyone realized Why is it necessary

I don't.
Reply

#3
(01-28-2016, 09:03)SuperNovaAO Wrote:
(01-27-2016, 20:17)S3VDIT0 Wrote: I think everyone realized Why is it necessary

I don't.

Oh sorry =)
I'm in a hurry and could not explain.
This script I made of the need to send server logs to my FTP server, just when I am on the VPS I dig into folders server lag, as well as my PC quickly send logs or complaints about the players...
Reply

#4
?
Reply

#5
(01-28-2016, 16:50)zhorakrnev Wrote: ?

, VPS , , ! FTP ( FTP ) , =)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help, server Admin largosik 0 2,286 02-02-2019, 18:09
Last Post: largosik
  Add a point shop to my server h1dexyz 1 3,142 03-04-2018, 22:36
Last Post: h1dexyz
  [Release] MW3 Server Addon Extensions master131 212 124,477 04-09-2017, 23:31
Last Post: huhu
Lightbulb Preview ^6(euroinfected)^2beginning all cfg FILES groochu1982 1 2,971 02-26-2017, 08:37
Last Post: tiraga
Lightbulb Preview ^1KmA^2HC TDM all cfg Files groochu1982 0 2,430 02-19-2017, 10:12
Last Post: groochu1982
Lightbulb Preview Weapon Classe For Infected Clasic Server groochu1982 0 2,440 02-19-2017, 08:35
Last Post: groochu1982
Exclamation Help HOW CAN I TURN OFF THE "CROSSHAIR" IN MY SERVER? Eliichong0 0 2,804 06-16-2016, 16:01
Last Post: Eliichong0

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.