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
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
add a comment |
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
add a comment |
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
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
php symfony zip symfony4 flysystem
edited Mar 3 at 19:03
Rikijs
asked Feb 28 at 18:19
RikijsRikijs
2201224
2201224
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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?"
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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?"
add a comment |
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?"
add a comment |
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?"
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?"
answered Mar 7 at 15:31
RikijsRikijs
2201224
2201224
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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