filestack / filestack-rails

Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
223 stars 102 forks source link

How to require filepicker lib and how to write onchange callback and return file url? #118

Closed Captain1 closed 9 years ago

Captain1 commented 9 years ago

1 Upload works fine in but i want to return file url after submission and store to my Doc:filepicker_url column. Then display the doc in an iframe: image

First question: How to require filepicker library in my docpicker.js file? I have put both the filepicker lib and my docpicker.js files before the end of body tag: image I also tried filepicker-node: https://www.npmjs.com/package/filepicker-node but received 'require' not defined when image

So how to correctly require the filepicker.js in Rails4.2?(I have nodejs installed both globally and in app(execjs gem installed)).

2 As mentioned in the document, any ideas on how to write onchange callback and extract event.fpfile.url and store into String 'filepicker_url' in my Doc Model? image

I use Rails for my school final project and i am new to javascript. Last semester teacher taught us angular, mongodb ,express, rails so I need time to absorb all these. Since is a stupid question please close this issue once i got the answer.

maurogeorge commented 9 years ago

To require the filepicker on rails 4.2 just use the filepicker_js_include_tag, as documented on README.

Please use the StackOverflow for questions/help, where a wider community will be able to help you. We reserve the issues tracker for issues only.