I'm trying to create a redmine plugin that uploads files.
I used this tutorials:
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: <h2>Pload#index</h2>
<h1>File Upload</h1> <%= form_tag('uploadFile', :multipart => true) %> <p><label for="upload_file">Select File</label> : <%= file_field 'pload', 'datafile' %></p> <%= 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.