mercredi 14 décembre 2016

Using the caught thing in the catch

im trying to make image uploader to my ftp server of my temp. site.

Code:

Dim img As New System.IO.MemoryStream
    Try
        PictureBox1.Image.Save(img, System.Drawing.Imaging.ImageFormat.Png)
    Catch

Static intt As Integer = 0
        intt += 1
        Label2.Text = intt
        ListBox1.Items.Add("http://ift.tt/2gLJq6s" & intt & ".png")


Try
            Dim imgupload As New Net.WebClient
            imgupload.Credentials = New Net.NetworkCredential("xxxxxxxx", "xxxxxxxxxx")
            imgupload.UploadData("http://ift.tt/2hOcZlF" & intt & ".png", img.ToArray)
        Catch
            MsgBox("Sht, site is down again.")
        End Try

I know thats hard to explain.

I want to do something like that;

You know this part ( imgupload.UploadData("http://ift.tt/2hOcZlF" & intt & ".png", img.ToArray) ) uploads the file to the server. And if file uploaded to server successfully, it should


intt += 1
        Label2.Text = intt
        ListBox1.Items.Add("http://ift.tt/2gLJq6s" & intt & ".png")

do that. How can i do that?

Aucun commentaire:

Enregistrer un commentaire