I’m trying to create a redmine plugin that uploads files.
I used this tutorials:
http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm
http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial
I already succeeded in uploading files using ruby on rails…
I want to integrate in a redmine plugin.
Here are my codes:
init.rb
Code:
require ‘redmine’
Redmine::Plugin.register :redmine_pload do
name ‘Redmine Pload plugin’
author ‘Author name’
description ‘This is a plugin for Redmine’
version ‘0.0.1’
url ‘http://example.com/path/to/plugin’
author_url ‘http://example.com/about’
menu :application_menu, :pload, { :controller => ‘pload’, :action =>
‘index’ }, :caption => ‘pload!’
end
pload_controller.rb
Code:
require ‘redmine’
Redmine::Plugin.register :redmine_pload do
name ‘Redmine Pload plugin’
author ‘Author name’
description ‘This is a plugin for Redmine’
version ‘0.0.1’
url ‘http://example.com/path/to/plugin’
author_url ‘http://example.com/about’
menu :application_menu, :pload, { :controller => ‘pload’, :action =>
‘index’ }, :caption => ‘pload!’
end
dota_file.rb
Code:
class DotaFile < ActiveRecord::Base
unloadable
def self.save(upload)
name = upload[‘dotafile’].original_filename
directory = “C:\Program Files\BitNami Redmine
Stack\apps\redmine\vendor\plugins\redmine_pload\public\data”
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, “wb”) { |f| f.write(upload[‘dotafile’].read) }
end
def self.filename(upload)
wholename = String.new
wholename = upload[‘dotafile’].original_filename
return wholename
end
end
index.html.rb
Code:
Pload#index
File Upload
<%= form_tag('uploadFile', :multipart => true) %>Select File : <%= file_field 'pload', 'datafile' %>
<%= submit_tag %> <%= form_tag %>my problem is… when i click the tab(link to plugin page) on redmine,
it jst shows this error.
Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine
administrator for assistance.
I am trying things to fix this for 3 days now, yet I have not found the
solution. Pls help me.