RizwanRizwan MemberComments: 7 Received thanks: 0 Member since: June 2018

Hello sir !I have made a image upload plugin and it has made thro shopware lightweight module but i have in trouble when i upload image 

1)how to define a path where my image has to be physically save 

2)how to save this this image name into database and then how to retrive it as well in any page 

i have installed lightweight plugin and used as well but their is no option such like that so kindly help me sir my action is : 

public function setAction()
      //$basePath = $this->request->getBasePath().'/media/upload/';

      $uploadedFile = '';
          $fileName = time().'_'.$_FILES['file']['name'];
          echo $fileName;die();
          $temporary = explode(".", $_FILES["file"]["name"]);
          $sourcePath = $_FILES['file']['tmp_name'];
          $targetPath =  $this->request->getBasePath().'/media/upload/'. $fileName;
              $uploadedFile = $fileName;
      $name = $this->Request()->getParam('name');
      //$image = $this->Request()->$fileName;
      $articleid = $this->Request()->getParam('articleid');
      $image = $this->Request()->file_put_contents('file', 'name');
      echo $image;die();
$desc = $this->Request()->getParam('desc');
$desclong = $this->Request()->getParam('desclong');
$sts =  $this->Request()->getParam('sts',0);
$sql = "insert into bcgh_custom_data (name,article_id, description, descriptionLong,active,image) 
      values ('{$name}', {$articleid}, '{$desc}', '{$desclong}',{$sts},'{$image}')";
$data = Shopware()->Db()->exec($sql);
      /*return $this->redirect(
                'controller'=> 'ExampleModulePlainHtml',
                'action' => 'index')



what would i used here properly 

my input field name is "image" my target action is setAction


Sign In or Register to comment.