ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
481
481
EMPFEHLEN
-
Gute Morgen zusammen und ein Frohes neues Jahr

ich habe ein Problem bei der Implementierung einer Anzeige des Fortschritts beim Upload einer Datei.
Für den Upload selber habe ich ein Tool verwendet das eigene Klassen erstellt und diese sich dann in VS befinden. Diese heißen:
Code :1 2 3
Imports CHILKATCERTIFICATELib Imports CHILKATFTP2Lib Imports Chilkat
Durch diese Bibliotheken, kann ich einfache Funktionen verwenden. Da ich aber nicht die einfache Windows Funktion verwende
Code :1
My.Computer.Network.UploadFile(parameter)
kann ich dann auch leider nicht auf den Parameter der Fortschrittanzeige zugreifen.
Nun ist die Frage, wie ich das am besten anstellen soll, dass mir eine Anzeige beim Upload angezeigt wird?!
Hier noch mein ganzer Code damit ihr Euch ein Bild machen könnt was ich gerade meine
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
Imports CHILKATCERTIFICATELib Imports CHILKATFTP2Lib Imports Chilkat Imports MSWinsockLib Imports System Imports Microsoft Imports System.Net Imports Microsoft.Win32 Public Class Uploadvorgang Dim ofd As New OpenFileDialog Dim sfd As New SaveFileDialog Dim ftp As New Chilkat.Ftp2() Dim success As Boolean Dim imagepfad As String Dim dialog As New WIA.CommonDialog Dim image As WIA.ImageFile = Nothing Dim i As String 'Datum Formatierung Dim datum As String Public Event UploadProgressChanged As UploadProgressChangedEventHandler Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click upload() fileExist() End Sub '################# Funktion Upload #################### Private Function upload() ' Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("Anything for 30-day trial") If (success <> True) Then MsgBox(ftp.LastErrorText) Return (0) Exit Function End If ftp.Hostname = "Die IP vom FTP Server" ftp.Username = "Benutzer" ftp.Password = "Passwort" ' The default data transfer mode is "Active" as opposed to "Passive". ' Connect and login to the FTP server. success = ftp.Connect() If (success <> True) Then MsgBox(ftp.LastErrorText, MsgBoxStyle.Information) Return (0) Exit Function End If ' Change to the remote directory where the file will be uploaded. success = ftp.ChangeRemoteDir("Zielordner") If (success <> True) Then MsgBox(ftp.LastErrorText & vbCrLf & "Auch das muss die Fehlermeldung sein", MsgBoxStyle.Information) Return (0) Exit Function End If MsgBox("Legen Sie ein Dokument in Ihren Scanner.") Try Image = dialog.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType, , , , False, ) Catch ex As Exception MsgBox("Ein Fehler ist aufgetreten! Überprüfen Sie ob das Gerät Eingeschaltet und angeschlossen ist." & Environment.NewLine & Environment.NewLine & ex.Message) End End Try datum = FormatDateTime(Now, DateFormat.ShortTime) datum = Replace(datum, " ", "_") ' leerzeichen durch unterstrich ersetzen datum = Replace(datum, ".", "") ' Punkte entfernen datum = Replace(datum, ":", "") ' Doppelpunkte entfernen If Not Image Is Nothing Then imagepfad = ("Quellordner") If FileExists(imagepfad + "img_" + datum + ".jpg") Then i = i + 1 image.SaveFile(imagepfad + "img_" + datum + "_" + i + ".jpg") Else image.SaveFile(imagepfad + "img_" + datum + ".jpg") End If Else MsgBox("Es wurde kein Bild erfasst!", MsgBoxStyle.Information, "Information") End End If ofd.InitialDirectory = "Quellordner" ofd.Filter = "Gescannte Dokumente (*.jpg)|*.jpg" ofd.Title = "Datei zum Öffnen auswählen" If ofd.ShowDialog() = DialogResult.OK Then MsgBox("Datei wurde ausgewählt.") Else MsgBox("Abbruch durch User.") End End If ' Upload a file. Dim localFilename As String localFilename = ofd.FileName Dim remoteFilename As String remoteFilename = ofd.SafeFileName Dim user As String Dim pwd As String Dim ziel As String ziel = "Zielordner" user = "benutzer" pwd = "passwort" success = ftp.PutFile(localFilename, remoteFilename) 'My.Computer.Network.UploadFile(ofd.SafeFileName, ziel, user, pwd, True) MsgBox("Warten Sie bis Sie sich eine infobox öffnet.", MsgBoxStyle.Critical) If (success <> True) Then MsgBox(ftp.LastErrorText) Return (0) Exit Function End If ftp.Disconnect() MsgBox("File Uploaded!") End Return (0) End Function '######################### Ende Funktion Upload ############################## '######################### Funktion FileExist ################################ Public Function fileExist() ' Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("Anything for 30-day trial") If (success <> True) Then MsgBox(ftp.LastErrorText, MsgBoxStyle.Information, "KANN SEIN3!") Return (0) Exit Function End If ftp.Hostname = "FTP IP" ftp.Username = "benutzer" ftp.Password = "password" ' Connect and login to the FTP server. success = ftp.Connect() If (success <> True) Then MsgBox(ftp.LastErrorText, MsgBoxStyle.Information) Return (0) Exit Function End If ' Set the current remote directory to where the file is located: success = ftp.ChangeRemoteDir("Zielordner") If (success <> True) Then MsgBox(ftp.LastErrorText & vbCrLf & "Das muss die Fehlermeldung sein", MsgBoxStyle.Information) Return (0) Exit Function End If ' Test to see if the file exists by getting the file size by name. ' If a -1 is returned, the file does not exist. Dim fileSize As Long fileSize = ftp.GetSizeByName(ofd.SafeFileName) If (fileSize < 0) Then Text = Text & "file does not exist" & vbCrLf Else Text = Text & "file exists and is " & fileSize & " bytes in size" & vbCrLf End If ftp.Disconnect() Return (0) End Function '######################### Ende Funktion FileExist ########################### Private Function FileExists(ByVal FileName As String) As Boolean On Error Resume Next FileExists = Not CBool(GetAttr(FileName) And (vbDirectory Or vbVolume)) On Error GoTo 0 End Function End Class
Ähnliche Themen
-
Upload Und Fortschritt.
Von mckani im Forum PHPAntworten: 15Letzter Beitrag: 11.07.11, 23:58 -
FTP Upload Fortschritt
Von Hookah im Forum C/C++Antworten: 5Letzter Beitrag: 02.10.09, 07:45 -
Fortschritt bei Upload anzeigen
Von Katzenbauer im Forum .NET Web und KommunikationAntworten: 9Letzter Beitrag: 22.02.07, 09:57 -
Anzeige Fortschritt nicht / oder?
Von hemi im Forum Visual Basic 6.0Antworten: 1Letzter Beitrag: 07.09.03, 21:06 -
Fortschritt-Anzeige bei Datei-Upload
Von Maikel im Forum PHPAntworten: 5Letzter Beitrag: 13.06.02, 12:26





Zitieren
Login





