FTP Files Upload Error in VB6 -
i'm developing project in required communicate mitsubishi m70 cnc (an ftp server) through vb6. though initial communication successful, when try upload or download file ,following error occurs :
error 120003 200 type set 200 port command successful 500 cannot copy file/directory. permission denied.
i'm able copy , paste files in folder manually. when try same through vb , showing error.
my project vb exe installed on same pc ftp server .
my code follows
option explicit private m_gettingdir boolean private sub addmessage(byval msg string) txtresults.text = txtresults.text & vbcrlf & msg txtresults.selstart = len(txtresults.text) end sub private sub cmdupload_click() dim host_name string dim cmd2 string enabled = false mousepointer = vbhourglass txtresults.text = "working" txtresults.selstart = len(txtresults.text) doevents ' must set url before user name , ' password. otherwise control cannot verify ' user name , password , error: ' ' unable connect remote host inetftp.url = "ftp://administrator:cnc@ncexplorer:8080/(192,168,1,101)/" inetftp.username = "administrator" inetftp.password = "cnc" ' path remote file copied cmd2 = "ftp://administrator:cnc@ncexplorer:8080/(192,168,1,101)/cnc%20memory/prg/user/new_test.txt" 'is syntax of remote file path correct? dont want copy 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 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 dim txt string dim chunk variant m_gettingdir = false 'get first chunk. chunk = inetftp.getchunk(1024, icstring) doevents 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
you're not giving ftp cpommand chance see final location. it's taking location literally cmd2
try concatenating destination string command
change this:
inetftp.execute , "put c:\test.txt cmd2"
to this
inetftp.execute , "put c:\test.txt " & cmd2
Comments
Post a Comment