2016-07-25 3 views
0

VB6을 통해 Mitsubishi M70 CNC (FTP 서버)와 통신해야하는 프로젝트를 개발 중입니다. 내가 업로드하거나 그것에 파일을 다운로드하려고 할 때 내 초기 통신, 성공하지만, 다음과 같은 오류가 발생합니다VB6에서 FTP 파일 업로드 오류

Error 120003 

200 Type set to I 
200 Port command successful 
500 Cannot Copy file/Directory. Permission Denied. 

내가 수동으로 폴더에 복사 한 파일을 붙여 넣을 수 있어요. 하지만 VB에서 동일한 작업을 수행하려고하면 오류가 표시됩니다.

내 프로젝트 VB exe는 내 FTP 서버와 동일한 PC에 설치됩니다. 당신은 ftp를 최종 위치를 볼 수있는 기회를 cpommand 포기하지 않을거야

Option Explicit 

Private m_GettingDir As Boolean 
Private Sub AddMessage(ByVal msg As String) 
    txtResults.Text = txtResults.Text & vbCrLf & msg 
    txtResults.SelStart = Len(txtResults.Text) 
End Sub 



Private Sub cmdUpload_Click() 
Dim host_name As String 
Dim CMD2 As String 

    Enabled = False 
    MousePointer = vbHourglass 
    txtResults.Text = "Working" 
    txtResults.SelStart = Len(txtResults.Text) 
    DoEvents 

    ' You must set the URL before the user name and 
    ' password. Otherwise the control cannot verify 
    ' the user name and password and you get the error: 
    ' 
    '  Unable to connect to remote host 

    inetFTP.URL = "ftp://Administrator:[email protected]:8080/(192,168,1,101)/" 
    inetFTP.UserName = "Administrator" 
    inetFTP.Password = "CNC" 



    ' This is the path where Remote File is to be Copied 


    CMD2 = "ftp://Administrator:[email protected]:8080/(192,168,1,101)/CNC%20MEMORY/PRG/USER/NEW_test.txt" 

    'Is the syntax of Remote file path Correct? I dont want to copy the file in Home directory 

    ' Execution 

    inetFTP.Execute , "PUT C:\TEST.TXT CMD2" 



    ' m_GettingDir = True 
    ' inetFTP.Execute , "Dir" 
    End Sub 
Private Sub inetFTP_StateChanged(ByVal State As Integer) 
    Select Case State 
     Case icError 
      AddMessage "Error: " & _ 
       " " & inetFTP.ResponseCode & vbCrLf & _ 
       " " & inetFTP.ResponseInfo 
     Case icNone 
      AddMessage "None" 
     Case icConnecting 
      AddMessage "Connecting" 
     Case icConnected 
      AddMessage "Connected" 
     Case icDisconnecting 
      AddMessage "Disconnecting" 
     Case icDisconnected 
      AddMessage "Disconnected" 
     Case icRequestSent 
      AddMessage "Request Sent" 
     Case icRequesting 
      AddMessage "Requesting" 
     Case icReceivingResponse 
      AddMessage "Receiving Response" 
     Case icRequestSent 
      AddMessage "Request Sent" 
     Case icResponseReceived 
      AddMessage "Response Received" 
     Case icResolvingHost 
      AddMessage "Resolving Host" 
     Case icHostResolved 
      AddMessage "Host Resolved" 

     Case icResponseCompleted 
      AddMessage inetFTP.ResponseInfo 

     If m_GettingDir Then 
      Dim txt As String 
      Dim chunk As Variant 
      m_GettingDir = False 

      'Get the first chunk. 
      chunk = inetFTP.GetChunk(1024, icString) 
      DoEvents 
      Do While Len(chunk) < 0 
       txt = txt & chunk 
       chunk = inetFTP.GetChunk(1024, icString) 
       DoEvents 
      Loop 

     ' AddMessage "----------" 
      AddMessage txt 
     End If 

    Case Else 
     AddMessage "State = " & Format$(State) 
End Select 

Enabled = True 
MousePointer = vbDefault 
End Sub 

답변

0

을 다음과 같이

내 코드입니다. 이

inetFTP.Execute , "PUT C:\TEST.TXT " & CMD2 
으로

inetFTP.Execute , "PUT C:\TEST.TXT CMD2" 

: 그것은 CMD2로 그대로

명령에 대상 문자열을 연결 시도

변경이 위치를 복용