koresho Posted May 21, 2010 Share Posted May 21, 2010 Hey there, I searched the forum, but didn't see anything that had to do with this issue. I'm creating a custom FTP interface for my company. Currently, I'm stuck on the issue that I cannot get the folder contents to refresh without completely exitting the script and connecting again. I am using _FTP_ListToArrayEx() to get the folder contents; this function does not appear to refresh the folder view when you call it a second time. I already tried using _FTP_Close() and reestablishing the connection before attempting the refresh (to get a new session ID) but this did not help. Any help is appreciated! Func _UpdateFolder($folder) ;Update the contents of the provided DIR _FTP_DirSetCurrent($FTP, $folder) ;Set the current directory to the new request $foldList = _FTP_ListToArrayEx($FTP, 0) ;This appears to be the problem area. This function doesn't actually gather more information from the server when it's called; it just reuses old data. $ls = "3" ;ignore the . and .. that my server returns Do If $foldList[$ls][2] <> "16" Then ;If the item isn't a folder $size = "B" If $foldList[$ls][1] >= "1024" Then $foldList[$ls][1] = $foldList[$ls][1] / "1024" ;turn >1024 bytes into KB $size = "KB" EndIf If $foldList[$ls][1] >= "1024" Then $foldList[$ls][1] = $foldList[$ls][1] / "1024" ;turn >1024 kbytes into MB $size = "MB" EndIf $listVitem = GUICtrlCreateListViewItem($foldList[$ls][0] & "|" & $foldList[$ls][2] & "|" & Round($foldList[$ls][1], 2) & $size, $fListV) Else $listTitem = GUICtrlCreateTreeViewItem($foldList[$ls][0], GUICtrlRead($fTreeV)) ;Folders go in the treeview EndIf $ls = $ls + 1 Until $ls > $foldList[0][0] EndFunc Link to comment Share on other sites More sharing options...
evilertoaster Posted May 21, 2010 Share Posted May 21, 2010 try using the INTERNET_FLAG_RELOAD and INTERNET_FLAG_RESYNCHRONIZE as documented in the underlying FtpFindFirstFile function http://msdn.microsoft.com/en-us/library/aa384146(v=VS.85).aspx (which is called by _FTP_ListToArrayEx). Link to comment Share on other sites More sharing options...
koresho Posted May 21, 2010 Author Share Posted May 21, 2010 try using the INTERNET_FLAG_RELOAD and INTERNET_FLAG_RESYNCHRONIZE as documented in the underlying FtpFindFirstFile function http://msdn.microsoft.com/en-us/library/aa384146(v=VS.85).aspx (which is called by _FTP_ListToArrayEx).You are a savior. I completely forgot the flags existed, and your solution worked perfectly. Thanks so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now