My coding is
Private Function GetAuthenticateToken() As String
Dim flickr As New Flickr("9855637e1efcb0a7245c2dfb5523774b", "6634b31122809bd7")
Dim frob As String = flickr.AuthGetFrob()
Return flickr.AuthCalcUrl(frob, AuthLevel.Write)
End Function
Dim authotoken As String = GetAuthenticateToken()
Private myFlickr As New Flickr("9855637e1efcb0a7245c2dfb5523774b", "6634b31122809bd7", authotoken)
Private myFlickrId As String
' Recursively called to upload the contents of individual folders
Private Sub ImportFolder(ByVal strPath As String, Optional ByVal strFolderName As String = "")
'Change this to whatever string delimiter you would like to use.
Dim strDelimeter As String = " ~ "
Dim dir As DirectoryInfo = New DirectoryInfo(strPath)
If dir.Exists Then
strFolderName = strFolderName & IIf(strFolderName <> "", strDelimeter, "") & dir.Name
Dim strTitle As String
Dim strDescription As String
Dim boolAlreadyExists As Boolean = False
'Are there files in the directory
If dir.GetFiles.Length > 0 Then
' handle files in that directory
Dim myPhotos As IList(Of String) = New List(Of String)
For Each f As FileInfo In dir.GetFiles
'Only handle Jpeg files, more file types could be added here.
If f.Extension.ToLower = ".jpg" Then
'Set the Photo Title
strTitle = dir.Name & strDelimeter & f.Name.Replace(f.Extension, "")
'Set the Photo Description
strDescription = strFolderName & strDelimeter & f.Name.Replace(f.Extension, "")
'Output for debugging purposes.
HttpContext.Current.Response.Write(strTitle & "<br />")
'If the files does not already exists then
If boolAlreadyExists = False Then
'Upload the photo
Dim strPhotoId As String = myFlickr.UploadPicture(f.FullName, strTitle, strDescription, "", False, True, True)
'Add to PhotoCollection
myPhotos.Add(strPhotoId)
End If
End If
Next
'Take the uploaded Photos and add them to a newly created set.
If myPhotos.Count > 0 Then
Dim myPhotoSet As Photoset = myFlickr.PhotosetsCreate(strFolderName, myPhotos(0).ToString)
myPhotos.RemoveAt(0) 'Pop off the first element because it was already added at set creation
For Each strPhotoId As String In myPhotos
myFlickr.PhotosetsAddPhoto(myPhotoSet.PhotosetId, strPhotoId)
Next
End If
End If
' loop through all sub directories
For Each subDirPath As String In Directory.GetDirectories(strPath)
ImportFolder(subDirPath, strFolderName)
Next
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
ImportFolder()
End Sub
in the button click event ImportFolder() give error .
Please check my coding