Download file using Paperclip - ruby-on-rails-4

Firstly, this might be duplicate question but due to time limitation, i couldn't search throughly. I wish to download a file that was uploaded using paperclip. My code to download is below:
def download_digital
#photo = Photo.find(params[:photo])
send_file #photo.image.path,
filename: #photo.image_file_name,
type: #photo.image_content_type,
disposition: 'attachment',
x_sendfile: true
puts "-----------Downloded----------"
end
When this is called, i get
Sent file /Users/c193/Documents/***/***/***/public/assets/photos/298/original/Wedding_2.jpeg (0.1ms)
-----------Downloaded----------
This makes it clear that the file is obtained. However, the file is not being actually downloaded. I dont know what i'm missing. I'm a newbie so any guidance will be helpful .
P.S: Also sorry for a duplicate question (in case; time limitation and no clue what to search). Thank You in advance.

I don't know if what is found the problem was actually is the problem but so far i have come to the conclusion that the use of ajax was what was creating an issue. In the console i got that the file is downloaded but it was not actually getting downloaded. I am posting a new question for the same. If anyone has an explanation for such behaviour, please post a comment regarding this. Thanx :)

Related

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

How to find the file modification using change Journal in windows using c++

I want to find the file or directory changes using Change Journal in windows.. I want a complete example code in c++.. Can anyone explain what change journal is actually and help in this.?
Check out the post added by Harry Johnston, i think this will the best suitable answer for you. Please find his link How can I detect only deleted, changed, and created files on a volume? . It contains sample code to detect changes in the journal entries. To know more about journals you need to refer msdn link https://msdn.microsoft.com/en-us/library/windows/desktop/aa363798(v=vs.85).aspx

How do I fix an xstring exception with tmxparser? SFML/C++

I currently I have a problem that when I run my code, it stops at an exception at line 3467 in the xstring system file. Here is a few screenshots of it:
.
I figured it had to do something to do with loading the file or the file is corrupted. Something is wrong with how it parses. Here is the link to my Github page. I used the tmxlite parser to load the file, here is also a link to the tmxlite Github page. Thanks so much! Sorry if this is a dumb question. I really have not programmed C++ for long, and done it without proper training. This is the tmx file link
I am so sorry for those who looked at this. It turns out I needed to edit my tmx files to include the tsx files and add the tsx files to the project. I am so sorry if I made anyone look for the answer when all I had to do was just use the resources in front of me. Thanks to underscore_d for telling me make it into a MCVE, leading me to find the answer. All this time... Sorry anyone whose time I wasted.

How to read a .shd file in C++?

I am creating a project in c++ for getting JobSettings of a job in a queue from .shd file.Can anyone please suggest me which API is used for reading .shd file?
If you're talking about the shadow file from the Windows spooler, take a look at this site and code accordingly - http://www.undocprint.org/formats/winspool/shd
Please note that this format is undocumented and so could change ever so often.

File Signature Validation

I Have used a utility written by Mark Russinovich, it is used to validate the file signature.
Any one have ideas how this can be done, i know it is not a simple code, but just i need some hints, APIs, steps, A guide map, Just to go in the correct direction.
I read too much a bout the cryptAPIs, then I read too much about the certAPIs, but i cannot get any thing useful to simply link a given file with the (unknown to me) data stored in the windows.
if any can help me in this issue please help, thanks a lot.
You should read about Authenticode.