This repository has been archived by the owner on Apr 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Error when no asset source defined #132
Labels
Comments
Can you post this error? |
PHP notice
Undefined index: assetsource
/Path/To/website/craft/plugins/import/controllers/ImportController.php(53)
41 public function actionUpload()
42 {
43 // Get import post
44 $import = craft()->request->getRequiredPost('import');
45
46 // Get file
47 $file = \CUploadedFile::getInstanceByName('file');
48
49 // Is file valid?
50 if (!is_null($file)) {
51
52 // Get source
53 $source = craft()->assetSources->getSourceTypeById($import['assetsource']);
54
55 // Get folder to save to
56 $folderId = craft()->assets->getRootFolderBySourceId($import['assetsource']);
57
58 // Save file to Craft's temp folder for later use
59 $fileName = AssetsHelper::cleanAssetName($file->name);
60 $filePath = AssetsHelper::getTempFilePath($file->extensionName);
61 $file->saveAs($filePath);
62
63 // Move the file by source type implementation
64 $response = $source->insertFileByPath($filePath, $folderId, $fileName, true);
65
Stack Trace
#0
– /Path/To/website/craft/app/etc/web/WebApp.php(685): CApplication->handleError(8, "Undefined index: assetsource", "/Path/To/website/craft/plugins/import/cont...", 53)
680 if (version_compare(PHP_VERSION, '7', '>=') && $code === 2 && strpos($message, 'should be compatible with') !== false)
681 {
682 return;
683 }
684
685 parent::handleError($code, $message, $file, $line);
686 }
687
688 // Private Methods
689 // =========================================================================
690
#1
– /Path/To/website/craft/plugins/import/controllers/ImportController.php(53): Craft\WebApp->handleError(8, "Undefined index: assetsource", "/Path/To/website/craft/plugins/import/cont...", 53, ...)
48
49 // Is file valid?
50 if (!is_null($file)) {
51
52 // Get source
53 $source = craft()->assetSources->getSourceTypeById($import['assetsource']);
54
55 // Get folder to save to
56 $folderId = craft()->assets->getRootFolderBySourceId($import['assetsource']);
57
58 // Save file to Craft's temp folder for later use
#2
+ /Path/To/website/craft/app/framework/web/actions/CInlineAction.php(49): Craft\ImportController->actionUpload()
#3
+ /Path/To/website/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(array("p" => "admin/import"))
#4
+ /Path/To/website/craft/app/framework/web/CController.php(286): CController->runAction(CInlineAction)
#5
+ /Path/To/website/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())
#6
+ /Path/To/website/craft/app/framework/web/CWebApplication.php(282): CController->run("upload")
#7
– /Path/To/website/craft/app/etc/web/WebApp.php(815): CWebApplication->runController("import/upload")
810 {
811 if ($this->request->isActionRequest())
812 {
813 $actionSegs = $this->request->getActionSegments();
814 $route = implode('/', $actionSegs);
815 $this->runController($route);
816 }
817 }
818
819 /**
820 * @return bool
#8
+ /Path/To/website/craft/app/etc/web/WebApp.php(285): Craft\WebApp->_processActionRequest()
#9
+ /Path/To/website/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#10
+ /Path/To/website/craft/app/index.php(62): CApplication->run()
#11
+ /Path/To/website/public/index.php(19): require_once("/Path/To/website/craft/app/index.php")
2016-08-15 13:58:49 Apache/2.4.18 (Unix) PHP/5.6.23 / Craft 2.6.2903 |
Closed
This should be handled better. The solution is to define an asset source. I will fix it in the next release. |
boboldehampsink
pushed a commit
that referenced
this issue
Sep 14, 2016
Can you try the latest |
Now on master |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The import won't proceed past the first step if no asset sources are defined - a PHP error is displayed.
The text was updated successfully, but these errors were encountered: