Sha256: 55885b7db8a0101c2cfd740cf7f1fa9ea2ee12258b2573e873f95acb22f851c8

Contents?: true

Size: 727 Bytes

Versions: 33

Compression:

Stored size: 727 Bytes

Contents

class UploadController < ApplicationController

  # return GPX file content enclosed in JSON response
  def gpx
    if user_signed_in?
      uploaded_io = params[:gpx_file]
      if uploaded_io.tempfile.size <= 1048576
        # NOTE: use content type "text/html" for file upload response
        #       see http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic-method-hasUpload
        render :text => CGI::escapeHTML({:success => true, :gpx => uploaded_io.read, :filename => uploaded_io.original_filename}.to_json)
      else
        render :text => CGI::escapeHTML({:success => false, :msg => "File size must be less than 1MB"}.to_json)
      end
    else
      render :nothing => true, :status => 404
    end
  end

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gb_mapfish_appserver-2.0.0 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.1.1 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.1.0 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.6 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.5 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.4 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.3 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.2 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.1 app/controllers/upload_controller.rb
gb_mapfish_appserver-1.0.0 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.7 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.6 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.5 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.4 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.3 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.2 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.1 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.9.0 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.8.7 app/controllers/upload_controller.rb
gb_mapfish_appserver-0.8.6 app/controllers/upload_controller.rb