yii2-cropper icon indicating copy to clipboard operation
yii2-cropper copied to clipboard

Hi i'm getting a 404 when i try to cropp de image

Open brizacho opened this issue 8 years ago • 7 comments

brizacho avatar Mar 10 '16 18:03 brizacho

I also got "404 Page not found"

Tried to debug and found that Widget::$uploadUrl is appended with "/" and become "/user/user/uploadPhoto/" The enabled option "enableStrictParsing" in my "urlManager" configuration lead to Yii can't parse "/user/user/uploadPhoto/" with extra slash at the end.

To fix it I added url rule with '?' like that

      'urlManager' => [
            'showScriptName' => false,     // Disable index.php
            'enablePrettyUrl' => true,     // Disable ?r= routes
            'enableStrictParsing' => true, // Only routes being listed in rules
            'rules' => [
                '/uploadUserPhoto?' => '/user/user/uploadPhoto',


And "404 Page not found" issue is solved for me.

pvolyntsev avatar Jun 20 '16 21:06 pvolyntsev

I have same problem. When I upload image, and submit button Crop photo, after in console of browser appears such a alert " http://localhost/st2/frontend/web/uploads/post/ Failed to load resource: the server responded with a status of 404 (Not Found) "

 <?= $form->field($model, 'image')->widget(Widget::className(), [
    'uploadUrl' => Url::toRoute('uploads/post/'),
]) ?>

.

}
public function actions()
{
    return [
        'uploadPhoto' => [
            'class' => 'budyaga\cropper\actions\UploadAction',
            'url' =>  Yii::$app->request->baseUrl.'/uploads/post/thumb',
            'path' => Yii::$app->request->baseUrl.'/uploads/post/thumb',
        ]
    ];
}

How can I fix it?

kh-mirzaev avatar Jul 04 '16 06:07 kh-mirzaev

Я решил проблему так: В видах указал контроллер загрузки изображений: 'uploadUrl' => '/adminpanel/products/uploadPhoto', А в контроллере в качестве пути сделал: 'path' => $_SERVER['DOCUMENT_ROOT'].'/uploads', https://pastebin.com/jtAXXMaD

vacoo avatar Nov 14 '17 06:11 vacoo

Hi i'm getting a 404 when i try to click in crop image.please help me to resolve this issue

aoonuos2013 avatar Jun 02 '18 09:06 aoonuos2013

just make a page in the controller and receive all information about the image and do all your entries in data base and return 1

mayankpal100 avatar Aug 13 '18 09:08 mayankpal100

use this [https://github.com/rezaei121/yii2-jcrop] ( it works very good)

mayankpal100 avatar Aug 17 '18 07:08 mayankpal100

`` <?= $form->field($model, 'image')->widget(Widget::className(), [

'uploadUrl' =>Yii::$app->urlManager->createUrl('uploads'),

]) ?>``

mehdi-hashemi-01 avatar Dec 01 '23 23:12 mehdi-hashemi-01