Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create directory on FTP server
    text
    copied!<p><em>I am using the following code for creating the folder on FTP server ; But its not working in my case :-</em></p> <pre><code> Dim sFilePath as string =filepath Dim ftpResponse1 As FtpWebResponse Dim ftpRequest1 As FtpWebRequest Dim IsExists1 As Boolean = True ftpRequest1 = CType(FtpWebRequest.Create(sFilePath), FtpWebRequest) ftpRequest1.UseBinary = True ftpRequest1.Credentials = New NetworkCredential(ZXFTPUSER, ZXFTPPASS) ftpRequest1.UsePassive = True ftpRequest1.Method = WebRequestMethods.Ftp.MakeDirectory 'ftpRequest1.KeepAlive = False 'ftpResponse1 = ftpRequest1.GetResponse() 'ftpResponse1 = ftpRequest1.GetResponse() 'Dim strstream1 As Stream = ftpResponse1.GetResponseStream() 'Dim strreader1 As New StreamReader(strstream1) 'Console.WriteLine(strreader1.ReadToEnd()) 'strreader1.Close() 'strstream1.Close() 'ftpResponse1.Close() </code></pre> <p><em>Please help me.</em></p> <p>In the above case i am not getting any error but when i am going to upload a rar file then it is giving the following exception </p> <p>The remote server returned an error: (550) File unavailable (e.g., file not found, no access).</p> <p><em>And File Upload code is given below</em></p> <pre><code> Public Sub FTPUpload(ByVal SourceFile() As IO.FileInfo, ByVal folderLevel As Integer, ByVal ftpPassiveMode As Boolean) ZXFTPPASS = "******" Dim filePath As New IO.DirectoryInfo(filePaths) Dim ftpRequest As FtpWebRequest Dim dResult As Windows.Forms.DialogResult Dim ftpFilePath As String = "" Dim levelPath As String = "" Dim iLoop As Integer Dim uFile As IO.FileInfo For Each uFile In SourceFile Try ftpFilePath = levelPath &amp; "/" &amp; uFile.Name ftpRequest = CType(FtpWebRequest.Create(ftpFilePath), FtpWebRequest) ftpRequest.Credentials = New NetworkCredential(ZXFTPUSER, ZXFTPPASS) ftpRequest.UsePassive = ftpPassiveMode ftpRequest.UseBinary = True ftpRequest.KeepAlive = False ftpRequest.Method = WebRequestMethods.Ftp.UploadFile 'Read in the file Dim b_file() As Byte = System.IO.File.ReadAllBytes(filePath.FullName &amp; "\" &amp; uFile.Name.ToString()) 'Upload the file Dim cls_stream As Stream = ftpRequest.GetRequestStream() cls_stream.Write(b_file, 0, b_file.Length) cls_stream.Close() cls_stream.Dispose() 'MsgBox("Uploaded Successfully", MsgBoxStyle.Information) Catch MsgBox("Failed to upload.Please check the ftp settings", MsgBoxStyle.Critical) End Try Next End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload