Access filesystem from AEM - aem

Is there a way to access a file (present on the File System) from AEM. More specifically, I have requirement wherein:
1. I need to fetch a custom log file (present under crx-quickstart/logs/.log
2. Send an email with this file attached via AEM
Any inputs would be really appreciated.

You can do this via java fileinputstream and associated api's. Use relative paths to access the file so that once your code is deployed to other environments(servers) it doesn't error out with any IO exception.

The answer to this question is same as Link to your answer
This is just a suggestion that go for the question suggested by the stackoverflow first when you are typing your question. As the same question has already been asked before.
Thank you...

Related

How can I open an external app with a file?

I have a question, I can't find the right one online.
I create a file and then want it to be opened by the app that matches the extension. Which should the user decide for himself if necessary. Such as e.g. opening an attachment in a mail.
Unfortunately, I can't find anything how I can persuade the system to do so with dart / flutter.
Can someone please help me.
Many thanks.
Mike
This plugin seems to do what you want
https://pub.dev/packages/open_file
Try to pass file path to open method as pecified in documentation
OpenFile.open("/sdcard/example.txt");

Searching inside JSONs in Chrome devtools

Is there a possibility to searching inside all JSON objects from all available responses in the network tab? Currently it works, but very randomly and isn't much reliable. Sometimes and especially in a smaller responses it's ok but when you have more assets almost always looking for, e.g. specific params value ends unsuccessfully. Do you know any smart solution of that issue? I've checked and first question associated with it has already few years and Google devs still haven't responded.
Example: I have object ID in response body, but cannot find it by search CTRL+F
I think one way is to save all the response in a file (manually or automatically, if possibile by using a browser extension).
After you have stored all the responses in a file you can parse the file and find things inside the file by using a script or just regex.
You can save the answers (as HAR file) manually (I use firefox) by right clicking on a network response inside the developer console panel.
I found that is the same for chrome.
Look here:
https://developers.google.com/web/tools/chrome-devtools/network/reference
I didn't search if there is a way to automatically store all the responses received by a browser. I'm not sure, but I think it isn't possible :/

SLIM API - Offer Files to Download

I am using Slim API for my Project. I want to offer Files for Download (Mostly PDF files). I found several Ways sending out a public link to the file, which i dont want. I also found an Middleware for the Version 2.4 of Slim, but I am using 3.x.
I just want to access the Route e.g. /downloads/version/2183
And the a Downlod with this certain File ID should start. I have a Path to the File on the Server in a variable available.
The Basic Idea behind is different restrictions, which user can download the file - but i can do that myself - the problem where I am stuck is, how to bring the Download over the Route to the Clients Browser
Does anyone know how to achieve this?
Cheers,
Niklas
This is actually very easy.
Set the Proper Headers for the file on the Response Object
Read the contents of the file into the body of the Response Object
$app->get('/my/file', function ($req, $res, $args) {
return $res->withHeader('Content-Type', 'application/octet-stream')
->withHeader('Content-Disposition', 'attachment')
->write(file_get_contents("file.txt"));
});

Uploading to specified target with jQuery fileupload?

I'm using jQuery fileupload on a site to upload a single file for processing. I've got a simple upload working based on the Basic Plus demo, but would like to upload files to a given path and filename on the server (independent of the filename on the client machine). It seems like this should be straightforward, but I'm having problems figuring it out or finding resources. Is this possible in jQuery fileupload? If so, can anybody point me in the right direction for how?
Thanks for your time!
Answered? Found some helpful information here on changing the filename of uploads.

Dropbox: how do I get the ACL for a file?

Given a file, how can I find who the file is visible to (shared with)?
This doesn't appear to be in metadata, and the /shares path generates a link.
So, how can we tell who has access?
The Dropbox API currently does not offer a way to find the shared status of files like this.