0

I want to get the full path with the file but do not want to upload the file in the application.

3
  • 3
    for security reason you can't get the full path of the the file Commented Jun 14, 2013 at 7:46
  • 1
    Honestly, I don't really understand this quiestion Commented Jun 14, 2013 at 7:47
  • I think he means on the client side, like when user select a file send to application where is that file located on users computer... like Salil mentioned: not possible Commented Jun 24, 2013 at 9:31

1 Answer 1

0

do you mean

link_to 'download file', 'http://someotherserverwheremyfileisstored.com/file/123.pdf'

???

or is that file static in `myproject/public/subfolder/myfile.pdf'

link_to 'download file', 'subfolder/myfile.pdf'

or you mean file path

%W(#{Rails.root}/public/subfolder/myfile.pdf)
# =# ["/home/user/myproject/public/subfolder/myfile.pdf"]
Sign up to request clarification or add additional context in comments.

2 Comments

I only want to get the path of the file which is selected by user
so you mean the path of a file on the user side not the application-server side. I'm not really sure but I think that's not possible (not only) with Rails (see for yourself: rubydoc.info/github/rails/rails/master/ActionDispatch/Http/…). When you uploading file you are sending just filename, type and content, not the actual path where the file is located on client machine (security reason). You canno't do it with JavaScript either for same security reason stackoverflow.com/questions/1635329/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.