Prikazi cijelu temu 11.12.2013 23:50
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Upload fajla
PreuzmiIzvorni kôd (Visual Basic):
  1. Option Explicit
  2. Private Declare Sub Sleep Lib "kernel32.dll" _
  3.     (ByVal dwMilliseconds As Long)
  4. Private Function UploadFile(ByVal sURL As String _
  5.     , ByVal sUserName As String _
  6.     , ByVal sPassword As String _
  7.     , ByVal sLocalFileName As String _
  8.     , ByVal sRemoteFileName As String) As Boolean
  9.     'Pessimist
  10.    UploadFile = False
  11.     With Inet1
  12.         .UserName = sUserName
  13.         .Password = sPassword
  14.         .Execute sURL, "PUT " & sLocalFileName & " " & sRemoteFileName
  15.         'Mayhaps, a better idea would be to implement
  16.        'StateChanged event handler
  17.        Do While .StillExecuting
  18.             Sleep 100
  19.             DoEvents
  20.         Loop
  21.         UploadFile = (.ResponseCode = 0)
  22.         Debug.Print .ResponseCode
  23.     End With
  24. End Function
  25. Private Sub cmdUpload_Click()
  26.     UploadFile "ftp://localhost", "", "", "C:\Test.txt", "/Level1/Uploaded.txt"
  27. End Sub

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.