Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » File is not a valid upload

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2 3
Go to End
Author Topic: 3596 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    I found where is the problem. It's a SilverStripe bug.
    After using move_uploaded_file (AssetAdmin.php Line:225) the is_uploaded_file function (Upload.php Line: 480) return false.
    is_uploaded_file function should be used with the original path and name of the uploaded file.

    Therefore, this check should be removed from the validate() function (Upload.php) and included in the doUpload($data, $form) function (AssetAdmin.php).

    Are you going to solve this problem in a new version?
    Can I expect a new version soon?

    Thank you very much.

    Regards,
    Jose A.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    More problems.

    If I add in mysite/_config.php:
    File:: $ apply_restrictions_to_admin = false;

    and try to upload an image through the CMS. It produces the following error:

    [User Error] Folder::addUploadToFolder: Couldn't copy '/var/www/vhosts/dominiox.com/httpdocs/silverstripe-cache/bar1111.jpg' to '/var/www/vhosts/dominiox.com/httpdocs/assets/Uploads/bar1111.jpg'
    POST /admin/assets/UploadForm

    Line 260 in /var/www/vhosts/dominiox.com/httpdocs/sapphire/filesystem/Folder.php

    I have to say that the bar1111.jpg file has been moved successfully to silverstripe-cache folder and is in it.
    The problem comes when SilverStripe try to move the file from silverstripe-cache folder to assets/Uploads folder.

    I think the problem is the internal check of the move_uploaded_file function, similar to the is_uploaded_file function.

    The documentation says (move_uploaded_file):
    This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

    As the file (bar1111.jpg) has been moved from its original position (/temp), checking POST upload mechanism fails.

    What version of SilverStripe is based the demo? http://demo.silverstripe.org
    There, CMS Files & Images section is working properly.
    Why?

    Am I doing something wrong?

    Please, if someone knows a solution for this.....

    Thanks,

    Regards,
    Jose A.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    I've seen the bug can be fixed using this patch:
    http://open.silverstripe.org/attachment/ticket/5547/2.4.1-FileUpload-2.diff

    but, why has not fixed in version 2.4.6 of SilverStripe?

    Regards,

    Jose A.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    Is not there someone of SilverStripe team to answer the question?

    Thanks,

    Jose A.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    How strange!
    Does nobody answer?

    Regards,
    Jose A.

  • Funfair77
    Avatar
    Community Member
    49 Posts

    Re: File is not a valid upload Link to this post

    Hello Jose,

    Maybe when you start a new topic they give us feedback.

    Marnix

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: File is not a valid upload Link to this post

    I will open a new topic.

    Thanks Marnix,

    Regards,

    3596 Views
Page: 1 2 3
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.