backend/app/controllers/images_controller.rb
def upload
    data = params[:json_data]
		images = JSON.parse(data)
		images.each do |image|
			@image = Image.find_by_id(image['id'])
			if @image.nil?
				@image = Image.create(:id => image['id'], :description => image['description'], :filename => image['filename'], :category => image['category'])
			end
		end
		
    respond_to do |format|
      format.html { redirect_to :controller => 'images', :action => 'index' }
    end
    
  end
# GET /images/upload
# for batch upload images through json.
GET /images/upload
for batch upload images through json.
GET / images / upload for batch upload images through json .
def upload
    data = params[:json_data]
		images = JSON.parse(data)
		images.each do |image|
			@image = Image.find_by_id(image['id'])
			if @image.nil?
				@image = Image.create(:id => image['id'], :description => image['description'], :filename => image['filename'], :category => image['category'])
			end
		end
    respond_to do |format|
      format.html { redirect_to :controller => 'images', :action => 'index' }
    end
  end
def upload data = params [ :json_data ] images = JSON . parse ( data ) images . each do | image | @image = Image . find_by_id ( image [ 'id' ] ) if @image . nil? @image = Image . create ( :id => image [ 'id' ] , :description => image [ 'description' ] , :filename => image [ 'filename' ] , :category => image [ 'category' ] ) end end respond_to do | format | format . html { redirect_to :controller => 'images' , :action => 'index' } end end
GET /images/upload
for batch upload images through json.
GET / images / upload for batch upload images through json .