<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="sans-serif">Hi everyone,<br>
<br>
I'm upgrading my D6 module to D7 and am trying to work out the
best way to implement the new File API...<br>
My module allows users to either upload a file from their
computer, or enter the relative path of a file already on the
server (e.g. /sites/default/themes/...). The relative path to this
file is then stored in the DB.<br>
<br>
I'm not sure what to store in the database in the D7 version: the
file URI (public://my_file.png) or the relative path as per the D6
version (/sites/default/files/my_file.png).<br>
The reasons I'm not sure are as follows:<br>
- Storing the File URI seems to be the obvious choice as that
seems to be the default now<br>
- But how would I allow users to enter the path of a file already
on the server in, say, their theme folder?<br>
- Storing the relative path is how I used to do it, so is easier<br>
- But then how do I change a relative path to a File URI when
required (e.g. by the image_style_url() function)?<br>
<br>
Any assistance or advice would be much appreciated!<br>
</font>
<pre class="moz-signature" cols="72">--
Kind regards,
Peter Anderson.
<a class="moz-txt-link-freetext" href="http://panda.id.au">http://panda.id.au</a>
</pre>
</body>
</html>