Error while creating ZIP file in Symfony4 with Flysystem and ZipAdapter2019 Community Moderator ElectionCertain mp3 files create zip errorReading zip file contents with PerlZipArchive can't unzip files that ZipArchive zips in PHPCreate a zip with SymfonySymfony 2 - Unzip a ZIP file & upload folder permissionsZiparchive unable to open zip file only in PHPServing files for download with Symfony3 and FlysystemLaravel Flysystem integration with Zip Archive AdapterThe user provider must return a UserInterface object, SYmfony 4 login errorLaravel: “Impossible to create the root directory” when storing file

Is it insecure to send a password in a `curl` command?

Python if-else code style for reduced code for rounding floats

Recruiter wants very extensive technical details about all of my previous work

Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible

The German vowel “a” changes to the English “i”

Book: Young man exiled to a penal colony, helps to lead revolution

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

Relationship between sampajanna definitions in SN 47.2 and SN 47.35

Is "upgrade" the right word to use in this context?

Custom alignment for GeoMarkers

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Can I use USB data pins as a power source?

How do you talk to someone whose loved one is dying?

What options are left, if Britain cannot decide?

Have the tides ever turned twice on any open problem?

Why is the President allowed to veto a cancellation of emergency powers?

How to write cleanly even if my character uses expletive language?

A single argument pattern definition applies to multiple-argument patterns?

Math equation in non italic font

What is "focus distance lower/upper" and how is it different from depth of field?

What is the adequate fee for a reveal operation?

When to use a slotted vs. solid turner?

Why does a Star of David appear at a rally with Francisco Franco?



Error while creating ZIP file in Symfony4 with Flysystem and ZipAdapter



2019 Community Moderator ElectionCertain mp3 files create zip errorReading zip file contents with PerlZipArchive can't unzip files that ZipArchive zips in PHPCreate a zip with SymfonySymfony 2 - Unzip a ZIP file & upload folder permissionsZiparchive unable to open zip file only in PHPServing files for download with Symfony3 and FlysystemLaravel Flysystem integration with Zip Archive AdapterThe user provider must return a UserInterface object, SYmfony 4 login errorLaravel: “Impossible to create the root directory” when storing file










0















Introduction



In my personal project i am using:



  • Symfony v4.2.3;

  • PHP v7.2.14


  • OnUp Flysystem bundle;


  • Flysystem ZipArchive.

  • on Windows 10 Pro (php built-in dev server);

File operations with Flysystem works fine both in project_dir/public folder and in project_dir/data folders.



Problem



When i try to create ZIP archive in public directory there is an error: Could not open zip archive at:zip:\test123my_zip_test.zip, error: 5.



My code




Controller that creates ZIP file




<?php

namespace AppController;

use AppUltraHelpersUltraAccess;
use AppUltraHelpersUltraWhereabouts;
use LeagueFlysystemAdapterLocal;
use LeagueFlysystemFilesystem;
use LeagueFlysystemMountManager;
use LeagueFlysystemZipArchiveZipArchiveAdapter;
use SymfonyComponentDependencyInjectionContainerInterface;
use SensioBundleFrameworkExtraBundleConfigurationIsGranted;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationSessionSessionInterface;
use SymfonyComponentRoutingAnnotationRoute;

class AdminZipController extends BaseController

/**
* @Route("/zip", name="zip")
*/
public function createZipArchive(Request $request, SessionInterface $session, MountManager $mountManager, ContainerInterface $container)


$kernel_project_dir = $container->getParameter('kernel.project_dir');
$adapter_public = new Local($kernel_project_dir .'/public/uploads/');
$adapter_zip = new ZipArchiveAdapter($kernel_project_dir .'/public/uploads/');

$filesystem_public = new Filesystem($adapter_public);
$filesystem_zip = new Filesystem($adapter_zip);

$mountManager->mountFilesystem('public', $filesystem_public);
$mountManager->mountFilesystem('zip', $filesystem_zip);

$public_path = 'public://test123/';
$public_zip = 'zip://test123/my_zip_test.zip';

$adapter_zip->openArchive($public_zip);

// get all files in directory
$files_2_zip = $mountManager->listContents($public_path, false);

// itereate trough all files in directory
foreach ($files_2_zip as $object)

$mountManager->copy($object['path'], $public_zip);


$adapter_zip->getArchive()->close();

return $this->render('default/create_zip_archive.html.twig', []);




Update 1



As ZIP file creation goes on in public folder, there should be no concerns about lack of access.



Update 2



As i am using Flysystem mount manager to easily manage files across same filesystem but different locations i would like to use the same setup also for ZIP files.



Update 3



Found that ZipAdapter uses PHP ZipArchive.
There are error codes in documentation.
So my problem: error 5 = read error



Finally



Am i missing something?



Thank you for your ideas and suggestions!










share|improve this question




























    0















    Introduction



    In my personal project i am using:



    • Symfony v4.2.3;

    • PHP v7.2.14


    • OnUp Flysystem bundle;


    • Flysystem ZipArchive.

    • on Windows 10 Pro (php built-in dev server);

    File operations with Flysystem works fine both in project_dir/public folder and in project_dir/data folders.



    Problem



    When i try to create ZIP archive in public directory there is an error: Could not open zip archive at:zip:\test123my_zip_test.zip, error: 5.



    My code




    Controller that creates ZIP file




    <?php

    namespace AppController;

    use AppUltraHelpersUltraAccess;
    use AppUltraHelpersUltraWhereabouts;
    use LeagueFlysystemAdapterLocal;
    use LeagueFlysystemFilesystem;
    use LeagueFlysystemMountManager;
    use LeagueFlysystemZipArchiveZipArchiveAdapter;
    use SymfonyComponentDependencyInjectionContainerInterface;
    use SensioBundleFrameworkExtraBundleConfigurationIsGranted;
    use SymfonyComponentHttpFoundationRequest;
    use SymfonyComponentHttpFoundationSessionSessionInterface;
    use SymfonyComponentRoutingAnnotationRoute;

    class AdminZipController extends BaseController

    /**
    * @Route("/zip", name="zip")
    */
    public function createZipArchive(Request $request, SessionInterface $session, MountManager $mountManager, ContainerInterface $container)


    $kernel_project_dir = $container->getParameter('kernel.project_dir');
    $adapter_public = new Local($kernel_project_dir .'/public/uploads/');
    $adapter_zip = new ZipArchiveAdapter($kernel_project_dir .'/public/uploads/');

    $filesystem_public = new Filesystem($adapter_public);
    $filesystem_zip = new Filesystem($adapter_zip);

    $mountManager->mountFilesystem('public', $filesystem_public);
    $mountManager->mountFilesystem('zip', $filesystem_zip);

    $public_path = 'public://test123/';
    $public_zip = 'zip://test123/my_zip_test.zip';

    $adapter_zip->openArchive($public_zip);

    // get all files in directory
    $files_2_zip = $mountManager->listContents($public_path, false);

    // itereate trough all files in directory
    foreach ($files_2_zip as $object)

    $mountManager->copy($object['path'], $public_zip);


    $adapter_zip->getArchive()->close();

    return $this->render('default/create_zip_archive.html.twig', []);




    Update 1



    As ZIP file creation goes on in public folder, there should be no concerns about lack of access.



    Update 2



    As i am using Flysystem mount manager to easily manage files across same filesystem but different locations i would like to use the same setup also for ZIP files.



    Update 3



    Found that ZipAdapter uses PHP ZipArchive.
    There are error codes in documentation.
    So my problem: error 5 = read error



    Finally



    Am i missing something?



    Thank you for your ideas and suggestions!










    share|improve this question


























      0












      0








      0








      Introduction



      In my personal project i am using:



      • Symfony v4.2.3;

      • PHP v7.2.14


      • OnUp Flysystem bundle;


      • Flysystem ZipArchive.

      • on Windows 10 Pro (php built-in dev server);

      File operations with Flysystem works fine both in project_dir/public folder and in project_dir/data folders.



      Problem



      When i try to create ZIP archive in public directory there is an error: Could not open zip archive at:zip:\test123my_zip_test.zip, error: 5.



      My code




      Controller that creates ZIP file




      <?php

      namespace AppController;

      use AppUltraHelpersUltraAccess;
      use AppUltraHelpersUltraWhereabouts;
      use LeagueFlysystemAdapterLocal;
      use LeagueFlysystemFilesystem;
      use LeagueFlysystemMountManager;
      use LeagueFlysystemZipArchiveZipArchiveAdapter;
      use SymfonyComponentDependencyInjectionContainerInterface;
      use SensioBundleFrameworkExtraBundleConfigurationIsGranted;
      use SymfonyComponentHttpFoundationRequest;
      use SymfonyComponentHttpFoundationSessionSessionInterface;
      use SymfonyComponentRoutingAnnotationRoute;

      class AdminZipController extends BaseController

      /**
      * @Route("/zip", name="zip")
      */
      public function createZipArchive(Request $request, SessionInterface $session, MountManager $mountManager, ContainerInterface $container)


      $kernel_project_dir = $container->getParameter('kernel.project_dir');
      $adapter_public = new Local($kernel_project_dir .'/public/uploads/');
      $adapter_zip = new ZipArchiveAdapter($kernel_project_dir .'/public/uploads/');

      $filesystem_public = new Filesystem($adapter_public);
      $filesystem_zip = new Filesystem($adapter_zip);

      $mountManager->mountFilesystem('public', $filesystem_public);
      $mountManager->mountFilesystem('zip', $filesystem_zip);

      $public_path = 'public://test123/';
      $public_zip = 'zip://test123/my_zip_test.zip';

      $adapter_zip->openArchive($public_zip);

      // get all files in directory
      $files_2_zip = $mountManager->listContents($public_path, false);

      // itereate trough all files in directory
      foreach ($files_2_zip as $object)

      $mountManager->copy($object['path'], $public_zip);


      $adapter_zip->getArchive()->close();

      return $this->render('default/create_zip_archive.html.twig', []);




      Update 1



      As ZIP file creation goes on in public folder, there should be no concerns about lack of access.



      Update 2



      As i am using Flysystem mount manager to easily manage files across same filesystem but different locations i would like to use the same setup also for ZIP files.



      Update 3



      Found that ZipAdapter uses PHP ZipArchive.
      There are error codes in documentation.
      So my problem: error 5 = read error



      Finally



      Am i missing something?



      Thank you for your ideas and suggestions!










      share|improve this question
















      Introduction



      In my personal project i am using:



      • Symfony v4.2.3;

      • PHP v7.2.14


      • OnUp Flysystem bundle;


      • Flysystem ZipArchive.

      • on Windows 10 Pro (php built-in dev server);

      File operations with Flysystem works fine both in project_dir/public folder and in project_dir/data folders.



      Problem



      When i try to create ZIP archive in public directory there is an error: Could not open zip archive at:zip:\test123my_zip_test.zip, error: 5.



      My code




      Controller that creates ZIP file




      <?php

      namespace AppController;

      use AppUltraHelpersUltraAccess;
      use AppUltraHelpersUltraWhereabouts;
      use LeagueFlysystemAdapterLocal;
      use LeagueFlysystemFilesystem;
      use LeagueFlysystemMountManager;
      use LeagueFlysystemZipArchiveZipArchiveAdapter;
      use SymfonyComponentDependencyInjectionContainerInterface;
      use SensioBundleFrameworkExtraBundleConfigurationIsGranted;
      use SymfonyComponentHttpFoundationRequest;
      use SymfonyComponentHttpFoundationSessionSessionInterface;
      use SymfonyComponentRoutingAnnotationRoute;

      class AdminZipController extends BaseController

      /**
      * @Route("/zip", name="zip")
      */
      public function createZipArchive(Request $request, SessionInterface $session, MountManager $mountManager, ContainerInterface $container)


      $kernel_project_dir = $container->getParameter('kernel.project_dir');
      $adapter_public = new Local($kernel_project_dir .'/public/uploads/');
      $adapter_zip = new ZipArchiveAdapter($kernel_project_dir .'/public/uploads/');

      $filesystem_public = new Filesystem($adapter_public);
      $filesystem_zip = new Filesystem($adapter_zip);

      $mountManager->mountFilesystem('public', $filesystem_public);
      $mountManager->mountFilesystem('zip', $filesystem_zip);

      $public_path = 'public://test123/';
      $public_zip = 'zip://test123/my_zip_test.zip';

      $adapter_zip->openArchive($public_zip);

      // get all files in directory
      $files_2_zip = $mountManager->listContents($public_path, false);

      // itereate trough all files in directory
      foreach ($files_2_zip as $object)

      $mountManager->copy($object['path'], $public_zip);


      $adapter_zip->getArchive()->close();

      return $this->render('default/create_zip_archive.html.twig', []);




      Update 1



      As ZIP file creation goes on in public folder, there should be no concerns about lack of access.



      Update 2



      As i am using Flysystem mount manager to easily manage files across same filesystem but different locations i would like to use the same setup also for ZIP files.



      Update 3



      Found that ZipAdapter uses PHP ZipArchive.
      There are error codes in documentation.
      So my problem: error 5 = read error



      Finally



      Am i missing something?



      Thank you for your ideas and suggestions!







      php symfony zip symfony4 flysystem






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 3 at 19:03







      Rikijs

















      asked Feb 28 at 18:19









      RikijsRikijs

      2201224




      2201224






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I managed to crate ZIP archives, but without utilizing mount manager. So the question stands: "Do ZipAdapter is not supposed/made to work with mount manager?"






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54931915%2ferror-while-creating-zip-file-in-symfony4-with-flysystem-and-zipadapter%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I managed to crate ZIP archives, but without utilizing mount manager. So the question stands: "Do ZipAdapter is not supposed/made to work with mount manager?"






            share|improve this answer



























              0














              I managed to crate ZIP archives, but without utilizing mount manager. So the question stands: "Do ZipAdapter is not supposed/made to work with mount manager?"






              share|improve this answer

























                0












                0








                0







                I managed to crate ZIP archives, but without utilizing mount manager. So the question stands: "Do ZipAdapter is not supposed/made to work with mount manager?"






                share|improve this answer













                I managed to crate ZIP archives, but without utilizing mount manager. So the question stands: "Do ZipAdapter is not supposed/made to work with mount manager?"







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 7 at 15:31









                RikijsRikijs

                2201224




                2201224





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid …


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54931915%2ferror-while-creating-zip-file-in-symfony4-with-flysystem-and-zipadapter%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

                    Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

                    How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page