<p>As per the Craft Docs at <a href="https://craftcms.com/docs/multi-environment-configs#environment-specific-variables" rel="nofollow noreferrer">https://craftcms.com/docs/multi-environment-configs#environment-specific-variables</a>, add a <code>basePath</code> (or other name) variable to you config. For MAMP, it should look something like:</p>

<p><code>'basePath' =&gt; '/Applications/MAMP/htdocs/example.dev/public/'</code></p>

<p>Then in your asset source settings, change File System Path to:</p>

<p><code>{basePath}assets/images/hero-images/</code></p>

CC BY-SA 3.0
2017-08-23T08:03:25.813Z
Unfortunately this didn't seem to work. 
Also using MAMPs given url (//projectname:8888/html/) as {siteUrl} seems to work fine in all my other projects. 
I also do not keep my sites in MAMPS htdocs folder, i keep them in a separate 'sites' folder so that I can work on more than one at once.
ToddPadwick
CC BY-SA 3.0
2017-08-23T18:59:32.317Z
Andrea's answer is definitely correct. Any time you have `{tag}`s within your asset sources' File System Path or URL settings, their values will be swapped out with the environment-specific variables, which are defined by the `environmentVariables` array  in general.php. Your array is empty, so it's expected that it wouldn't work for you.
Brandon Kelly
CC BY-SA 3.0
2017-08-22T17:16:31.520Z
2017-08-22T17:16:31.520Z
Andrea DeMers
<p>I have checked all other questions on stack exchange with similar titles and they don't seem to help my situation. 
I have added assets sources to craft CMS. but when uploading I get the following error:</p>

<blockquote>
  <p>The error message was: "Error uploading the file:  The file system path "{siteUrl}assets/images/hero-images/" set for this source does not exist."</p>
</blockquote>

<p>I am working locally using MAMP. I do not have multiple environments. only local.</p>

<p>the <em>siteUrl</em> variable seems to work fine when used directly in templates. just doesn't work for assets. </p>

<p>File system path is</p>

<pre><code>assets/images/hero-images/
</code></pre>

<p>URL is</p>

<pre><code>{siteUrl}assets/images/hero-images/
</code></pre>

<p>General config is set to</p>

<pre><code>return array(

    // Base site URL
    'siteUrl' =&gt; "//projectname:8888/html/",

    // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)
    'environmentVariables' =&gt; array(),

    // Default Week Start Day (0 = Sunday, 1 = Monday...)
    'defaultWeekStartDay' =&gt; 0,

    // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
    'enableCsrfProtection' =&gt; true,

    // Whether "index.php" should be visible in URLs (true, false, "auto")
    'omitScriptNameInUrls' =&gt; 'auto',

    // Control Panel trigger word
    'cpTrigger' =&gt; 'admin',

    // Dev Mode (see https://craftcms.com/support/dev-mode)
    'devMode' =&gt; false,

);
</code></pre>

<p>If I open the assets in chrome, this is their file path.</p>

<pre><code>http://projectname:8888/html/assets/images/hero-images/be-inspired-mobile.jpg
</code></pre>

<p>This is driving me mad and have checked everything. </p>

<p>I am using exactly the same config settings as all my other sites which work absolutely fine.
Any help will be really appreciated :)</p>

<assets><error-message><siteurl>
Craft asset urls not working
# Craft asset urls not working

(Asked by: username_0 on 2017-08-22)

I have checked all other questions on stack exchange with similar titles and they don't seem to help my situation. 
I have added assets sources to craft CMS. but when uploading I get the following error:

The error message was: "Error uploading the file:  The file system path "{siteUrl}assets/images/hero-images/" set for this source does not exist."

I am working locally using MAMP. I do not have multiple environments. only local.
the siteUrl variable seems to work fine when used directly in templates. just doesn't work for assets. 
File system path is
assets/images/hero-images/

URL is
{siteUrl}assets/images/hero-images/

General config is set to
return array(

    // Base site URL
    'siteUrl' => "//projectname:8888/html/",

    // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)
    'environmentVariables' => array(),

    // Default Week Start Day (0 = Sunday, 1 = Monday...)
    'defaultWeekStartDay' => 0,

    // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
    'enableCsrfProtection' => true,

    // Whether "index.php" should be visible in URLs (true, false, "auto")
    'omitScriptNameInUrls' => 'auto',

    // Control Panel trigger word
    'cpTrigger' => 'admin',

    // Dev Mode (see https://craftcms.com/support/dev-mode)
    'devMode' => false,

);

If I open the assets in chrome, this is their file path.
http://projectname:8888/html/assets/images/hero-images/be-inspired-mobile.jpg

This is driving me mad and have checked everything. 
I am using exactly the same config settings as all my other sites which work absolutely fine.
Any help will be really appreciated :)

**Tags:** assets, error-message, siteurl

---

## 1 answers

### Answer by username_1 on 2017-08-22. Score: 1

As per the Craft Docs at <https://craftcms.com/docs/multi-environment-configs#environment-specific-variables>, add a `basePath` (or other name) variable to you config. For MAMP, it should look something like:

`'basePath' => '/Applications/MAMP/htdocs/example.dev/public/'`

Then in your asset source settings, change File System Path to:

`{basePath}assets/images/hero-images/`

> **Comments:**
> **username_0**: Unfortunately this didn't seem to work.  Also using MAMPs given url (//projectname:8888/html/) as {siteUrl} seems to work fine in all my other projects.  I also do not keep my sites in MAMPS htdocs folder, i keep them in a separate 'sites' folder so that I can work on more than one at once.  
> **username_2**: Andrea's answer is definitely correct. Any time you have `{tag}`s within your asset sources' File System Path or URL settings, their values will be swapped out with the environment-specific variables, which are defined by the `environmentVariables` array  in general.php. Your array is empty, so it's expected that it wouldn't work for you.  

---

