def url_upload
      url = @options[:url].strip

      content = RestClient.get(url) rescue nil

      file = Tempfile.new('tmp').tap do |file|
        file.binmode # must be in binary mode
        file.write(content)
        file.rewind
      end if content

      # Extract the file name from the URL
      filename = url.split('/').last

      # Mime type
      type = @options[:mimetype] || mimetype(filename)

      {:filename => filename, :type => type, :tempfile => file}
    end
def url_upload
      url = @options[:url].strip

      content = RestClient.get(url) rescue nil

      file = Tempfile.new('tmp').tap do |file|
        file.binmode # must be in binary mode
        file.write(content)
        file.rewind
      end if content

      # Extract the file name from the URL
      filename = url.split('/').last

      # Mime type
      type = @options[:mimetype] || mimetype(filename)

      {:filename => filename, :type => type, :tempfile => file}
    end
URL upload