Skip to content

Instantly share code, notes, and snippets.

@finnp
Created September 8, 2013 16:44
Show Gist options
  • Save finnp/6486332 to your computer and use it in GitHub Desktop.
Save finnp/6486332 to your computer and use it in GitHub Desktop.
Bulk uploading pictures to an app in Podio
require 'rubygems'
require 'podio'
app_id = '<ID of the App'
dir = "<Directory of images>"
titels = "<Image Title>" # Index gets added automatically
i = 1 # Starting index for the title
Dir.foreach(dir) do |item|
next if item == '.' or item == '..' or item[-3..-1] != "jpg"
File.open(dir + item) do |f|
file = Podio::FileAttachment.upload(f, item)
puts file.file_id
Podio::Item.create( app_id, {
:fields => {
"<title>" => titels + i.to_s,
"<image>" => file.file_id,
"<additional-field>" => "<e.g. general description for all the pictures" # Further fields can be added
}
} )
end
i += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment