Comments (5)
Hi thanks for finding it useful. I believe you can get the URL as a string type. This is how I do it for container type:
class Attachment
include Filemaker::Model
database 'MyDB'
layout 'Attachment'
# This is the container type URL being parse using URI.parse at
# lib/filemaker/metadata/field.rb#L73
string :attachment_url, fm_name: 'Attachment URL'
end
Do let me know if you can set it up :)
from filemaker-ruby.
Yes - my bad!
Do you have any functionality to get around the username/password dialog that is raised by the filmmaker server?
from filemaker-ruby.
You can download it using Net::HTTP
with Basic Authentication:
def download_protected_file
req = Net::HTTP::Get.new(attachment_url)
req.basic_auth(ENV['FILEMAKER_ACCOUNT_NAME'], ENV['FILEMAKER_PASSWORD'])
res = Net::HTTP.new(ENV['FILEMAKER_HOST'], 80)
res = res.start { |http| http.request(req) }
res.body
end
from filemaker-ruby.
Thanks! Did the following for https compatibility:
uri = URI.parse("https://" + attachment_url)
Net::HTTP.start(uri.host, uri.port,
:use_ssl => uri.scheme == 'https',
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
request = Net::HTTP::Get.new uri.request_uri
request.basic_auth(ENV['FILEMAKER_ACCOUNT_NAME'], ENV['FILEMAKER_PASSWORD'])
response = http.request request # Net::HTTPResponse object
send_data(response.body, :filename => "filename.zip", :type => "application/zip, application/octet-stream")
end
Have a create weekend!
Andreas
from filemaker-ruby.
Yup you 2 :)
from filemaker-ruby.
Related Issues (11)
- Missing return of fields HOT 11
- error with rails HOT 1
- clear_changes_information HOT 4
- Update nokogiri dependency HOT 1
- Editing records HOT 1
- Able to search for work month
- replace_new_data is broken!
- `where` isn't properly searching records HOT 5
- belongs_to doesn't seem to function properly HOT 6
- Global and per-request timeout setting and parallel requests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filemaker-ruby.