File download - cannot open pdf file: permission deniedHow do I download a binary file over HTTP?Proper MIME media type for PDF filesMerge / convert multiple PDF files into one PDFInserting a pdf file in latexASP.NET MVC: How can I get the browser to open and display a PDF instead of displaying a download prompt?Cannot open dynamic PDF files in Internet ExplorerHow can I set a policy for an s3 bucket that allows authenticated users to list the bucket or get any file from the bucketAmazon S3 file 'Access Denied' exception in Cross-AccountLimitations on opening pdf file in AndroidOpening a tab with a PDF attachment in a WebviewLaravel- Unable to export to PDF because a binary supposedly has permission denied?

How much maintenance time did it take to make an F4U Corsair ready for another flight?

How does proof assistant organize knowledge?

Is 悪いところを見つかった proper Japanese?

Does Molecular Weight of a Gas affect its lifting properties at the same velocity over the same wing?

How would timezones work on a planet 100 times the size of our Earth

Safest way to store environment variable value in a file

Email address etiquette - Which address should I use to contact professors?

A Non Math Puzzle. What is the middle number?

These were just lying around

What is my malfunctioning AI harvesting from humans?

If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?

How can I decide if my homebrew item should require attunement?

Generate Brainfuck for the numbers 1–255

Is it feasible to get a hash collision for CRC32, MD-5 and SHA-1 on one file?

How can Radagast come across Gandalf and Thorin's company?

How to assign many blockers at the same time?

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?

Is this n-speak?

Random Double Arc Endpoint Angles

Bitcoin successfully deducted on sender wallet but did not reach receiver wallet

How can God warn people of the upcoming rapture without disrupting society?

Heating Margarine in Pan = loss of calories?

0xF1 opcode-prefix on i80286



File download - cannot open pdf file: permission denied


How do I download a binary file over HTTP?Proper MIME media type for PDF filesMerge / convert multiple PDF files into one PDFInserting a pdf file in latexASP.NET MVC: How can I get the browser to open and display a PDF instead of displaying a download prompt?Cannot open dynamic PDF files in Internet ExplorerHow can I set a policy for an s3 bucket that allows authenticated users to list the bucket or get any file from the bucketAmazon S3 file 'Access Denied' exception in Cross-AccountLimitations on opening pdf file in AndroidOpening a tab with a PDF attachment in a WebviewLaravel- Unable to export to PDF because a binary supposedly has permission denied?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I need do allow user to download pdf files directly from s3 bucket.
I figured out a method, which works correctly, but I cannot open downloaded files, getting Permission denied.



If I do it from console, everything is fine, and I can open downloaded pdf files afterwards.



Here's my method



 def download_pdf
pdf_url = @file.pdf_url
f = open(pdf_url)
FileUtils.mv(f.path, "#@file.id.pdf")
end


What can be wrong? I tried to close TempFile, as described here, but it didn't help










share|improve this question
























  • Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

    – oneWorkingHeadphone
    Mar 27 at 10:58











  • No, they are not. And I don't want to use send_data since I try to avoid streaming

    – Dende
    Mar 27 at 11:16











  • If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

    – oneWorkingHeadphone
    Mar 27 at 13:07

















0















I need do allow user to download pdf files directly from s3 bucket.
I figured out a method, which works correctly, but I cannot open downloaded files, getting Permission denied.



If I do it from console, everything is fine, and I can open downloaded pdf files afterwards.



Here's my method



 def download_pdf
pdf_url = @file.pdf_url
f = open(pdf_url)
FileUtils.mv(f.path, "#@file.id.pdf")
end


What can be wrong? I tried to close TempFile, as described here, but it didn't help










share|improve this question
























  • Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

    – oneWorkingHeadphone
    Mar 27 at 10:58











  • No, they are not. And I don't want to use send_data since I try to avoid streaming

    – Dende
    Mar 27 at 11:16











  • If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

    – oneWorkingHeadphone
    Mar 27 at 13:07













0












0








0








I need do allow user to download pdf files directly from s3 bucket.
I figured out a method, which works correctly, but I cannot open downloaded files, getting Permission denied.



If I do it from console, everything is fine, and I can open downloaded pdf files afterwards.



Here's my method



 def download_pdf
pdf_url = @file.pdf_url
f = open(pdf_url)
FileUtils.mv(f.path, "#@file.id.pdf")
end


What can be wrong? I tried to close TempFile, as described here, but it didn't help










share|improve this question














I need do allow user to download pdf files directly from s3 bucket.
I figured out a method, which works correctly, but I cannot open downloaded files, getting Permission denied.



If I do it from console, everything is fine, and I can open downloaded pdf files afterwards.



Here's my method



 def download_pdf
pdf_url = @file.pdf_url
f = open(pdf_url)
FileUtils.mv(f.path, "#@file.id.pdf")
end


What can be wrong? I tried to close TempFile, as described here, but it didn't help







ruby-on-rails pdf amazon-s3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 9:22









DendeDende

1482 silver badges11 bronze badges




1482 silver badges11 bronze badges















  • Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

    – oneWorkingHeadphone
    Mar 27 at 10:58











  • No, they are not. And I don't want to use send_data since I try to avoid streaming

    – Dende
    Mar 27 at 11:16











  • If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

    – oneWorkingHeadphone
    Mar 27 at 13:07

















  • Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

    – oneWorkingHeadphone
    Mar 27 at 10:58











  • No, they are not. And I don't want to use send_data since I try to avoid streaming

    – Dende
    Mar 27 at 11:16











  • If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

    – oneWorkingHeadphone
    Mar 27 at 13:07
















Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

– oneWorkingHeadphone
Mar 27 at 10:58





Are the files on S3 public (yes: just use the link and let them download; no: use send_data to access and send)? Are you uploading them there with ActiveStorage to begin with?

– oneWorkingHeadphone
Mar 27 at 10:58













No, they are not. And I don't want to use send_data since I try to avoid streaming

– Dende
Mar 27 at 11:16





No, they are not. And I don't want to use send_data since I try to avoid streaming

– Dende
Mar 27 at 11:16













If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

– oneWorkingHeadphone
Mar 27 at 13:07





If you compare the file sizes between what you can pull from the command line and what's saved with your download_pdf function, are they the same?

– oneWorkingHeadphone
Mar 27 at 13:07












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373643%2ffile-download-cannot-open-pdf-file-permission-denied%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373643%2ffile-download-cannot-open-pdf-file-permission-denied%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현