I want to get the full path with the file but do not want to upload the file in the application.
-
3for security reason you can't get the full path of the the fileSalil– Salil2013-06-14 07:46:36 +00:00Commented Jun 14, 2013 at 7:46
-
1Honestly, I don't really understand this quiestionbluehallu– bluehallu2013-06-14 07:47:12 +00:00Commented 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 possibleequivalent8– equivalent82013-06-24 09:31:54 +00:00Commented Jun 24, 2013 at 9:31
Add a comment
|
1 Answer
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"]
2 Comments
Sailee Mogale
I only want to get the path of the file which is selected by user
equivalent8
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/…