Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

File is not a valid upload


Go to End


23 Posts   7290 Views

Avatar
Josua

Community Member, 87 Posts

13 January 2012 at 8:18am

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.

Avatar
Josua

Community Member, 87 Posts

13 January 2012 at 9:43am

Edited: 13/01/2012 9:54am

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.

Avatar
Josua

Community Member, 87 Posts

13 January 2012 at 10:25pm

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.

Avatar
Josua

Community Member, 87 Posts

14 January 2012 at 2:51am

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

Thanks,

Jose A.

Avatar
Josua

Community Member, 87 Posts

17 January 2012 at 12:22am

How strange!
Does nobody answer? :(

Regards,
Jose A.

Avatar
Funfair77

Community Member, 49 Posts

17 January 2012 at 2:24am

Edited: 17/01/2012 2:24am

Hello Jose,

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

Marnix

Avatar
Josua

Community Member, 87 Posts

17 January 2012 at 5:14am

I will open a new topic.

Thanks Marnix,

Regards,

Go to Top