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

                    Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                    2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

                    Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme