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

Silverstripe 3.0.2 - UploadField 400 Bad Request


Go to End


11 Posts   7000 Views

Avatar
fyrebase

Community Member, 7 Posts

5 October 2012 at 2:40am

Hi,

UploadFields are currently giving me a 400 Bad Request error in my local dev environment - OS X PHP 5.3.17

The following is my error log for an UploadField request...

If anyone has any ideas, I'm all ears.

[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP Warning: error_log(error_log) [<a href='function.error-log'>function.error-log</a>]: failed to open stream: Permission denied in /Users/bollox/Sites/ksid/__ss/framework/dev/LogFileWriter.php on line 61, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP Stack trace:, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 1. {main}() /Users/bollox/Sites/ksid/__ss/framework/main.php:0, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 2. Director::direct() /Users/bollox/Sites/ksid/__ss/framework/main.php:126, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 3. Director::handleRequest() /Users/bollox/Sites/ksid/__ss/framework/control/Director.php:112, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 4. AdminRootController->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/control/Director.php:283, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 5. LeftAndMain->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/admin/code/AdminRootController.php:88, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 6. Controller->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/admin/code/LeftAndMain.php:353, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 7. RequestHandler->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/control/Controller.php:149, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 8. RequestHandler->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/control/RequestHandler.php:186, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 9. RequestHandler->handleRequest() /Users/bollox/Sites/ksid/__ss/framework/control/RequestHandler.php:186, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 10. UploadField->upload() /Users/bollox/Sites/ksid/__ss/framework/control/RequestHandler.php:168, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 11. Upload->loadIntoFile() /Users/bollox/Sites/ksid/__ss/framework/forms/UploadField.php:492, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 12. Upload->load() /Users/bollox/Sites/ksid/__ss/framework/filesystem/Upload.php:179, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 13. copy() /Users/bollox/Sites/ksid/__ss/framework/filesystem/Upload.php:158, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 14. errorHandler() /Users/bollox/Sites/ksid/__ss/framework/filesystem/Upload.php:158, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 15. Debug::warningHandler() /Users/bollox/Sites/ksid/__ss/framework/dev/Debug.php:697, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 16. SS_Log::log() /Users/bollox/Sites/ksid/__ss/framework/dev/Debug.php:254, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 17. Zend_Log->log() /Users/bollox/Sites/ksid/__ss/framework/dev/Log.php:176, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 18. Zend_Log_Writer_Abstract->write() /Users/bollox/Sites/ksid/__ss/framework/thirdparty/Zend/Log.php:428, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 19. SS_LogFileWriter->_write() /Users/bollox/Sites/ksid/__ss/framework/thirdparty/Zend/Log/Writer/Abstract.php:85, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14
[Thu Oct 04 23:34:52 2012] [error] [client 192.168.1.1] PHP 20. error_log() /Users/bollox/Sites/ksid/__ss/framework/dev/LogFileWriter.php:61, referer: http://www-dev.ksid.kgb/admin/pages/edit/show/14

Avatar
Rob Clarkson

Community Member, 26 Posts

5 October 2012 at 3:55pm

Edited: 05/10/2012 3:58pm

I've got the same problem.

I'm using SS 3.0.2 on Win7 64bit

Latest version of Xampp Apache 2.4.2

My Error log shows no problems. I just get 400 Bad Request when i try to upload a file by dragging it into the "drop area". This is in the CMS backend.

Avatar
Rob Clarkson

Community Member, 26 Posts

5 October 2012 at 4:09pm

I've fixed it somehow. It wasnt a dev build or a flush, cos those were the first things i tried.

try editing then publishing your object that has the image.

Then try uploading again.

Good luck

Avatar
fyrebase

Community Member, 7 Posts

5 October 2012 at 10:23pm

Thanks for the suggestion RobboDev... but it didn't work for me. I'll keep digging.

Avatar
fyrebase

Community Member, 7 Posts

5 October 2012 at 11:18pm

Looks like it is a permissions issue on the assets/Uploads folder. I can now upload images, however the image preview does not show.

Avatar
Marcus

Administrator, 89 Posts

30 October 2012 at 12:36pm

I've noticed the problem occurs if I visit the ModelAdmin edit URL directly (eg admin/objects/MyObject/EditForm/field/MyObject/item/1/edit), but if I navigate to the edit view from the ModelAdmin view, there's no problem. I'm guessing there's a JS initialisation problem somewhere that's not binding some information that's needed for doing uploads correctly - will see if I can find anything else out

Avatar
pinkp

Community Member, 182 Posts

27 February 2013 at 7:34am

I have this on SS3, when I drag and drop reorder as I release I get the 'bad request' error.
Any idea what causes this? thanks

Avatar
kinglozzer

Community Member, 187 Posts

27 February 2013 at 10:21pm

I seem to remember getting this error when I was incorrectly using $has_many for images. So make sure you aren't using $has_many for them, switch them to $many_many if you are and try again.

Go to Top