Jump to:

325 Posts in 200 Topics by 157 members

Migrating a Site to Silverstripe

SilverStripe Forums » Migrating a Site to Silverstripe » Uploading files [default cms]

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3098 Views
  • Naex
    Avatar
    Community Member
    7 Posts

    Uploading files [default cms] Link to this post

    I'm trying to use the CMS File & Images -> upload to get the pictures onto the server (remotely). I get the error:

    "Website Error
    There has been an error
    The website server has not been able to respond to your request."

    I haven't adjusted any code.

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: Uploading files [default cms] Link to this post

    Try again but this time put ?isDev=1 (or &isDev=1 if the URL already has a ?) on the end of the URL. That should put the site in dev mode and give you a more usable error message.

  • Naex
    Avatar
    Community Member
    7 Posts

    Re: Uploading files [default cms] Link to this post

    [Warning] copy(/var/www/www.earlyyearsniagara.org/htdocs/assets/test.jpg) [function.copy]: failed to open stream: Permission denied
    POST /admin/assets/UploadForm

    Line 195 in /var/www/www.earlyyearsniagara.org/htdocs/sapphire/filesystem/Folder.php
    Source

    186       Filesystem::makeFolder(dirname("$base/$file"));
    187       
    188       while(file_exists("$base/$file")) {
    189          $i = isset($i) ? ($i+1) : 2;
    190          $oldFile = $file;
    191          $file = ereg_replace('[0-9]*(\.[^.]+$)',$i . '\\1', $file);
    192          if($oldFile == $file && $i > 2) user_error("Couldn't fix $file with $i", E_USER_ERROR);
    193       }
    194       
    195       if(file_exists($tmpFile['tmp_name']) && copy($tmpFile['tmp_name'], "$base/$file")) {
    196          // Update with the new image
    197          return $this->constructChild(basename($file));
    198       } else {
    199          user_error("Folder::addUploadToFolder: Couldn't copy '$tmpFile[tmp_name]' to '$file'", E_USER_ERROR);
    200          return false;
    201       }

    Trace

    * copy(/tmp/phpJzgj9J,/var/www/www.earlyyearsniagara.org/htdocs/assets/commitedcfg.cfg)
    Line 195 of Folder.php
    * Folder->addUploadToFolder(Array)
    Line 217 of AssetAdmin.php
    * AssetAdmin->doUpload(Array,Form,HTTPRequest)
    Line 241 of Form.php
    * Form->httpSubmission(HTTPRequest)
    Line 129 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 143 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 122 of Controller.php
    * Controller->handleRequest(HTTPRequest)
    Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    * Director::direct(/admin/assets/UploadForm)
    Line 118 of main.php

    Do I just need to increase the permissions?

  • Sher
    Avatar
    Community Member
    2 Posts

    Re: Uploading files [default cms] Link to this post

    I just overcame this problem by changing the permissions of the assets folder to 777

  • websage
    Avatar
    Community Member
    6 Posts

    Re: Uploading files [default cms] Link to this post

    Thanks man, you just saved me hours of work.
    Also make sure to look up with ls -la the Apache User in Ubuntu. Standard user is www-data and group www-data.
    To change open secure shell and do a chown -R www-data:www-data ./assets
    This is a quick fix so your client won't go mad. In the meantime you can check if you really should give full permissions
    to all files contained in /assets.

    Have a great time!

    Frank

    3098 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.