<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to read file from a subfolder in files/application?</title><link>https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application</link><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;we created a subfolder in files/application and uploaded a file in this subfolder.
Now I would like to read this file to send it as an Email-attachment.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;File f = new File("subfolder\\testfile.pdf",false);
java.io.File Anhang =new java.io.File(f.getName());
in.anhang=Anhang;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But ivy doesn't find the File.
When we upload the file directly in files/application it works.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 19 Apr 2017 05:45:35 -0400</lastBuildDate><item><title>Comment by Alex Suter on SupportIvyTeam's answer</title><link>https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application#2584</link><description>&lt;p&gt;testtesttest&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Wed, 19 Apr 2017 05:45:35 -0400</pubDate><guid>https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application#2584</guid></item><item><title>Answer by SupportIvyTeam</title><link>https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application/2530</link><description>&lt;p&gt;Your second line causes the problem. &lt;code&gt;f.getName()&lt;/code&gt; only returns the filename, without the subfolder. You have to use &lt;code&gt;f.getPath()&lt;/code&gt;, which returns the relative path of the current file object. This path is always relative to the active file area:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Temporary files: session&lt;/li&gt;
&lt;li&gt;Persistent files: application&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SupportIvyTeam</dc:creator><pubDate>Fri, 24 Mar 2017 15:24:02 -0400</pubDate><guid>https://answers.axonivy.com/questions/2529/how-to-read-file-from-a-subfolder-in-files-application/2530</guid></item></channel></rss>