Zipper icon indicating copy to clipboard operation
Zipper copied to clipboard

i have an error with using Zipper : The path "http://localhost:8000/books/20/20.zip" is not writeable

Open afshmini opened this issue 9 years ago • 1 comments

this is my code : $zip=new Zipper(); $zip->make('http://localhost:8000/books/20/20.zip')->folder('http://localhost:8000/books/')->extractTo('20'); and returned this error: The path "http://localhost:8000/books/20/20.zip" is not writeable

afshmini avatar Nov 13 '15 08:11 afshmini

It looks like you're missing a couple of the basic concepts of the tool. I would suggest re-reading the README file as it is pretty well written. Your main problems are that you are trying to make a zip file with a url as opposed to a local file path (which is why you can't write to it). Also, you're specifying a folder for the wrong reasons, folder is for creating a folder within the zip.

  1. The make method takes a string, the relative path of the file, not a url. By default it will write the "public" folder. If you were to use $zip->make('20.zip') it will create a 20.zip file in the public directory.
  2. The folder method takes the name of a folder to create inside the zip in which subsequent files will be created, again, not a url.
  3. Your call to extractTo will extract the content of the zip into public/20 which might be what you're looking for.

Basically you're asking your server to create a zip file at a remote url (http://localhost:8000/books/20/20.zip), create a folder in it called 'http://localhost:8000/books/', and then extract it. I think what you're really looking to do is open an existing zip file and extract it. Re-read the documentation and pay close attention to 1) the difference between the zip and make methods and 2) the proper usage of the folder and extractTo methods.

webbtj avatar Nov 13 '15 18:11 webbtj