2016-04-07 25 views
1

FTP sunucusunda dosya yüklerken bir sorunum var. Bilgisayarımda (127.0.0.1) FileZilla sunucusunu çalıştırdığımda, görüntü dosyaları başarılı bir şekilde yüklenir. Fakat FileZilla sunucusunu aynı ağdaki başka bir bilgisayarda çalıştırıyorum (10.0.1.25). Bu bilgisayarda dizin oluşturabilirim ancak kullanıcı bilgisayarım üzerinde tam kontrole sahip olsa da görüntü dosyasını yükleyemiyorum. i reqFTP.UsePassive = doğru hat 9 değiştiğindeYerel ağda FTP dosya yükleme C#

public bool Upload(Stream srcStream, string dstFilePath) 
    { 
     Create FtpWebRequest object from the Uri provided 
     FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(serverUri + dstFilePath)); 
     reqFTP.Credentials = credential; 
     reqFTP.Method = WebRequestMethods.Ftp.UploadFile; 
     reqFTP.UseBinary = true; 
     reqFTP.Proxy = null; 
     reqFTP.UsePassive = false; 
     reqFTP.KeepAlive = false; 
     reqFTP.ContentLength = srcStream.Length; 
     byte[] buff = new byte[UPLOAD_DOWNLOAD_BUFFER_SIZE]; 
     int contentLen; 

     // Stream to which the file to be upload is written 

      using (Stream dstStream = reqFTP.GetRequestStream()) 
      { 
       // Read from the file stream 2kb at a time 
       contentLen = srcStream.Read(buff, 0, UPLOAD_DOWNLOAD_BUFFER_SIZE); 

       // Till Stream content ends 
       while (contentLen != 0) 
       { 
        // Write Content from the file stream to the FTP Upload Stream 
        dstStream.Write(buff, 0, contentLen); 
        contentLen = srcStream.Read(buff, 0, UPLOAD_DOWNLOAD_BUFFER_SIZE); 
       } 

       dstStream.Close(); 
      } 
     } 

     // Get the response to the upload request. 
     bool ret; 
     FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse(); 
     // ret = (response.StatusCode == FtpStatusCode.ClosingData); // 
     response.Close(); 

     ret = (GetFileSize(dstFilePath) == srcStream.Length); 

     return ret; 
    } 

, sunucu (Pasif Modu (H1, H2, H3, H4, p1, p2) girilmesi 227) döndürür. Şimdi döner (500) Sözdizimi hatası, komut tanınmadı. Sorun ne olacak? Teşekkürler

+0

Virüsten koruma programımı durdurdum. Sonra dosya aktarılır. –

cevap

0

Virüs koruma çalışırken görüntüyü Filezilla yükleyebilirim. Ancak, kod blokumu kullanarak denediğimde. Bağlantı noktası hata iletisini döndürür. Antivirüs durdurulduktan sonra her şey iyi çalışır.