Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript error and wrong upload path #1

Open
rubenheymans opened this issue Sep 18, 2014 · 10 comments
Open

Javascript error and wrong upload path #1

rubenheymans opened this issue Sep 18, 2014 · 10 comments

Comments

@rubenheymans
Copy link

When I want to upload an image, I get this error in firebug:
Error: Syntax error, unrecognized expression: /yii2-app-advanced/backend/web/filemanager/files/#
throw new Error( "Syntax error, unrecognized expression: " + msg );

Also the image do not upload, and after uploading I get the error in firebug:
"NetworkError: 404 Not Found -x/backend/web/filemanager/files/files/thumbnails/1411041436-550e95258718ddd46707505efe45c06e.jpg"

@linchpinstudios
Copy link
Collaborator

Sorry for the delay, I didn't see your message come in.

At what point is the error being thrown?

Also if you could provide the error in the /backend/runtime/logs/app.log that will help me debug it.

@PendalF89
Copy link

Hi! I have some problem.
1
2

App log:

2014-11-12 14:16:42 [127.0.0.1][-][-][error][yii\base\ErrorException:2] exception 'yii\base\ErrorException' with message 'move_uploaded_file(/images/uploads/1415787402-ec9b30b7ea69e35391f9c83494939481.jpg): failed to open stream: No such file or directory' in C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\UploadedFile.php:161
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'move_uploaded_f...', 'C:\\OpenServer\\d...', 161, Array)
#1 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\UploadedFile.php(161): move_uploaded_file('C:\\OpenServer\\u...', '/images/uploads...')
#2 C:\OpenServer\domains\yii2-modules.loc\vendor\linchpinstudios\yii2-filemanager\controllers\FilesController.php(209): yii\web\UploadedFile->saveAs('/images/uploads...')
#3 [internal function]: linchpinstudios\filemanager\controllers\FilesController->actionUpload()
#4 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#5 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#6 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('upload', Array)
#7 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\Application.php(83): yii\base\Module->runAction('filemanager/fil...', Array)
#8 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#9 C:\OpenServer\domains\yii2-modules.loc\backend\web\index.php(18): yii\base\Application->run()
#10 {main}
2014-11-12 14:16:42 [127.0.0.1][-][-][info][application] $_POST = [
    '_csrf' => 'VlV6YXFyVkF7EhwYPjw/AAFnTRkFEycsIzQ4DxI7FTIUOh4iOgQ.FQ=='
    'Files' => [
        'file_name' => ''
    ]
]

$_FILES = [
    'Files' => [
        'name' => [
            'file_name' => 'bike.jpg'
        ]
        'type' => [
            'file_name' => 'image/jpeg'
        ]
        'tmp_name' => [
            'file_name' => 'C:\\OpenServer\\userdata\\temp\\php26C4.tmp'
        ]
        'error' => [
            'file_name' => 0
        ]
        'size' => [
            'file_name' => 93083
        ]
    ]
]

$_COOKIE = [
    'last_position' => '/'
    'PHPSESSID' => '8igp12stndq41o8avjgpve1nc6'
    '_csrf' => 'a12b5744c0b1cbd21ab35a5e5cecb57bca7cd33cd9be56c68fa741f143db951fs:32:\"-GfyONiAW27xtaqmuaBncICsBodCKvhT\";'
    '_identity' => '2e3dd55d18bb42ac5216943d6e5db7f0f4c88aee174184451d18117a4539803bs:46:\"[1,\"fnYJ_VAXWYOkg6bUhjs7OAZtftoSh8x6\",2592000]\";'
]

$_SERVER = [
    'REDIRECT_STATUS' => '200'
    'HTTP_HOST' => 'admin.yii2-modules.loc'
    'HTTP_CONNECTION' => 'keep-alive'
    'CONTENT_LENGTH' => '93528'
    'HTTP_PRAGMA' => 'no-cache'
    'HTTP_CACHE_CONTROL' => 'no-cache'
    'HTTP_ORIGIN' => 'http://admin.yii2-modules.loc'
    'HTTP_X_CSRF_TOKEN' => 'VlV6YXFyVkF7EhwYPjw/AAFnTRkFEycsIzQ4DxI7FTIUOh4iOgQ.FQ=='
    'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36'
    'CONTENT_TYPE' => 'multipart/form-data; boundary=----WebKitFormBoundary7LPbr6B3WvqaXjNV'
    'HTTP_ACCEPT' => 'application/json, text/javascript, */*; q=0.01'
    'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
    'HTTP_REFERER' => 'http://admin.yii2-modules.loc/filemanager/files/index'
    'HTTP_ACCEPT_ENCODING' => 'gzip,deflate'
    'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4'
    'HTTP_COOKIE' => 'last_position=%2F; PHPSESSID=8igp12stndq41o8avjgpve1nc6; _csrf=a12b5744c0b1cbd21ab35a5e5cecb57bca7cd33cd9be56c68fa741f143db951fs%3A32%3A%22-GfyONiAW27xtaqmuaBncICsBodCKvhT%22%3B; _identity=2e3dd55d18bb42ac5216943d6e5db7f0f4c88aee174184451d18117a4539803bs%3A46%3A%22%5B1%2C%22fnYJ_VAXWYOkg6bUhjs7OAZtftoSh8x6%22%2C2592000%5D%22%3B'
    'PATH' => 'C:\\OpenServer\\modules\\php\\PHP-5.5\\ext;C:\\OpenServer\\modules\\php\\PHP-5.5\\pear;C:\\OpenServer\\modules\\php\\PHP-5.5\\pear\\bin;C:\\OpenServer\\modules\\imagemagick;C:\\OpenServer\\modules\\php\\PHP-5.5;C:\\OpenServer\\modules\\database\\MySQL-5.6\\bin;C:\\OpenServer\\modules\\memcached\\Memcached-1.4;C:\\OpenServer\\modules\\http\\Apache-2.4\\bin;C:\\OpenServer\\modules\\http\\Apache-2.4;C:\\OpenServer\\modules\\wget\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\system32\\Wbem;C:\\Windows\\SysWOW64;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files (x86)\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Users\\PendalF\\AppData\\Roaming\\npm'
    'SystemRoot' => 'C:\\Windows'
    'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe'
    'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
    'WINDIR' => 'C:\\Windows'
    'SERVER_SIGNATURE' => ''
    'SERVER_SOFTWARE' => 'Apache/2.4.9 (Win32)'
    'SERVER_NAME' => 'admin.yii2-modules.loc'
    'SERVER_ADDR' => '127.0.0.1'
    'SERVER_PORT' => '80'
    'REMOTE_ADDR' => '127.0.0.1'
    'DOCUMENT_ROOT' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web'
    'REQUEST_SCHEME' => 'http'
    'CONTEXT_PREFIX' => ''
    'CONTEXT_DOCUMENT_ROOT' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web'
    'SERVER_ADMIN' => '[no address given]'
    'SCRIPT_FILENAME' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web/index.php'
    'REMOTE_PORT' => '57372'
    'REDIRECT_URL' => '/filemanager/files/upload'
    'GATEWAY_INTERFACE' => 'CGI/1.1'
    'SERVER_PROTOCOL' => 'HTTP/1.1'
    'REQUEST_METHOD' => 'POST'
    'QUERY_STRING' => ''
    'REQUEST_URI' => '/filemanager/files/upload'
    'SCRIPT_NAME' => '/index.php'
    'PHP_SELF' => '/index.php'
    'REQUEST_TIME_FLOAT' => 1415787402.37
    'REQUEST_TIME' => 1415787402
    'argv' => []
    'argc' => 0
]

Settings:

'filemanager' => [
            'class'         => 'linchpinstudios\filemanager\Module',
            'thumbnails'    => [[100,100]],                                              // Optional: array
            'path'          => '/images/uploads/',                                       // Default relative to your web directory or AWS
            'thumbPath'     => '/images/uploads/thumbs/',
        ],

@linchpinstudios
Copy link
Collaborator

Does "images/uploads/thumbnails" path created within your web folder?

http://linchpinstudios.com/

Josh Hagel | Linchpin Studios: Owner
PO Box 28294 | Spokane, WA 99228
509.720.8730 | [email protected]

https://www.facebook.com/linchpinstudios
http://twitter.com/linchpinstudios [email protected]

On Wed, Nov 12, 2014 at 3:23 AM, PendalF89 [email protected] wrote:

Hi! I have some problem.
[image: 1]
https://cloud.githubusercontent.com/assets/5278851/5009329/51c5d39a-6a7f-11e4-940f-8e856d42c51a.png
[image: 2]
https://cloud.githubusercontent.com/assets/5278851/5009328/51c28834-6a7f-11e4-9a8c-5f84d9e1b784.png

App log:

2014-11-12 14:16:42 [127.0.0.1][-][-][error][yii\base\ErrorException:2] exception 'yii\base\ErrorException' with message 'move_uploaded_file(/images/uploads/1415787402-ec9b30b7ea69e35391f9c83494939481.jpg): failed to open stream: No such file or directory' in C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\UploadedFile.php:161
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'move_uploaded_f...', 'C:\OpenServer\d...', 161, Array)
#1 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\UploadedFile.php(161): move_uploaded_file('C:\OpenServer\u...', '/images/uploads...')
#2 C:\OpenServer\domains\yii2-modules.loc\vendor\linchpinstudios\yii2-filemanager\controllers\FilesController.php(209): yii\web\UploadedFile->saveAs('/images/uploads...')
#3 [internal function]: linchpinstudios\filemanager\controllers\FilesController->actionUpload()
#4 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#5 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#6 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('upload', Array)
#7 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\web\Application.php(83): yii\base\Module->runAction('filemanager/fil...', Array)
#8 C:\OpenServer\domains\yii2-modules.loc\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#9 C:\OpenServer\domains\yii2-modules.loc\backend\web\index.php(18): yii\base\Application->run()
#10 {main}
2014-11-12 14:16:42 [127.0.0.1][-][-][info][application] $_POST = [
'_csrf' => 'VlV6YXFyVkF7EhwYPjw/AAFnTRkFEycsIzQ4DxI7FTIUOh4iOgQ.FQ=='
'Files' => [
'file_name' => ''
]
]

$_FILES = [
'Files' => [
'name' => [
'file_name' => 'bike.jpg'
]
'type' => [
'file_name' => 'image/jpeg'
]
'tmp_name' => [
'file_name' => 'C:\OpenServer\userdata\temp\php26C4.tmp'
]
'error' => [
'file_name' => 0
]
'size' => [
'file_name' => 93083
]
]
]

$_COOKIE = [
'last_position' => '/'
'PHPSESSID' => '8igp12stndq41o8avjgpve1nc6'
'_csrf' => 'a12b5744c0b1cbd21ab35a5e5cecb57bca7cd33cd9be56c68fa741f143db951fs:32:"-GfyONiAW27xtaqmuaBncICsBodCKvhT";'
'_identity' => '2e3dd55d18bb42ac5216943d6e5db7f0f4c88aee174184451d18117a4539803bs:46:"[1,"fnYJ_VAXWYOkg6bUhjs7OAZtftoSh8x6",2592000]";'
]

$_SERVER = [
'REDIRECT_STATUS' => '200'
'HTTP_HOST' => 'admin.yii2-modules.loc'
'HTTP_CONNECTION' => 'keep-alive'
'CONTENT_LENGTH' => '93528'
'HTTP_PRAGMA' => 'no-cache'
'HTTP_CACHE_CONTROL' => 'no-cache'
'HTTP_ORIGIN' => 'http://admin.yii2-modules.loc'
'HTTP_X_CSRF_TOKEN' => 'VlV6YXFyVkF7EhwYPjw/AAFnTRkFEycsIzQ4DxI7FTIUOh4iOgQ.FQ=='
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36'
'CONTENT_TYPE' => 'multipart/form-data; boundary=----WebKitFormBoundary7LPbr6B3WvqaXjNV'
'HTTP_ACCEPT' => 'application/json, text/javascript, /; q=0.01'
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
'HTTP_REFERER' => 'http://admin.yii2-modules.loc/filemanager/files/index'
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate'
'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4'
'HTTP_COOKIE' => 'last_position=%2F; PHPSESSID=8igp12stndq41o8avjgpve1nc6; _csrf=a12b5744c0b1cbd21ab35a5e5cecb57bca7cd33cd9be56c68fa741f143db951fs%3A32%3A%22-GfyONiAW27xtaqmuaBncICsBodCKvhT%22%3B; _identity=2e3dd55d18bb42ac5216943d6e5db7f0f4c88aee174184451d18117a4539803bs%3A46%3A%22%5B1%2C%22fnYJ_VAXWYOkg6bUhjs7OAZtftoSh8x6%22%2C2592000%5D%22%3B'
'PATH' => 'C:\OpenServer\modules\php\PHP-5.5\ext;C:\OpenServer\modules\php\PHP-5.5\pear;C:\OpenServer\modules\php\PHP-5.5\pear\bin;C:\OpenServer\modules\imagemagick;C:\OpenServer\modules\php\PHP-5.5;C:\OpenServer\modules\database\MySQL-5.6\bin;C:\OpenServer\modules\memcached\Memcached-1.4;C:\OpenServer\modules\http\Apache-2.4\bin;C:\OpenServer\modules\http\Apache-2.4;C:\OpenServer\modules\wget\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\SysWOW64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\nodejs;C:\Program Files\TortoiseGit\bin;C:\Users\PendalF\AppData\Roaming\npm'
'SystemRoot' => 'C:\Windows'
'COMSPEC' => 'C:\Windows\system32\cmd.exe'
'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
'WINDIR' => 'C:\Windows'
'SERVER_SIGNATURE' => ''
'SERVER_SOFTWARE' => 'Apache/2.4.9 (Win32)'
'SERVER_NAME' => 'admin.yii2-modules.loc'
'SERVER_ADDR' => '127.0.0.1'
'SERVER_PORT' => '80'
'REMOTE_ADDR' => '127.0.0.1'
'DOCUMENT_ROOT' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web'
'REQUEST_SCHEME' => 'http'
'CONTEXT_PREFIX' => ''
'CONTEXT_DOCUMENT_ROOT' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web'
'SERVER_ADMIN' => '[no address given]'
'SCRIPT_FILENAME' => 'C:/OpenServer/domains/yii2-modules.loc/backend/web/index.php'
'REMOTE_PORT' => '57372'
'REDIRECT_URL' => '/filemanager/files/upload'
'GATEWAY_INTERFACE' => 'CGI/1.1'
'SERVER_PROTOCOL' => 'HTTP/1.1'
'REQUEST_METHOD' => 'POST'
'QUERY_STRING' => ''
'REQUEST_URI' => '/filemanager/files/upload'
'SCRIPT_NAME' => '/index.php'
'PHP_SELF' => '/index.php'
'REQUEST_TIME_FLOAT' => 1415787402.37
'REQUEST_TIME' => 1415787402
'argv' => []
'argc' => 0
]

Settings:

'filemanager' => [ 'class' => 'linchpinstudios\filemanager\Module', 'thumbnails' => [[100,100]], // Optional: array 'path' => '/images/uploads/', // Default relative to your web directory or AWS 'thumbPath' => '/images/uploads/thumbs/', ],


Reply to this email directly or view it on GitHub
#1 (comment)
.

@PendalF89
Copy link

Yes, i am using advanced template and create folder @backend/web/images/uploads/thumbs

@wisdomroma
Copy link

Do you have issue? I have this error too(((

@PendalF89
Copy link

Yes, I have had this error. But now don't checked. I've already written my file manager ;)

@linchpinstudios
Copy link
Collaborator

Sorry Pendal for the delay. Your system looks nice.

I've added a directory to the Module so that it looks for the directory. It seems to not be doing that on your configurations.

Let me know if the latest update works for you.

If you want to move it to the @frontend of your advanced configuration you can set that in your config file. Also note you should set the url for your front-end domain.

    'modules' => [
        'filemanager' => [
            'direcotry' => '@frontend/',
            'url' => 'http://frontend.com/'
        ],

@PendalF89
Copy link

Thank you!

@QuinLena15
Copy link

I have this error too(( What to do?

@ivantree
Copy link

me to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants