Coder Social home page Coder Social logo

Comments (6)

hanifsulong avatar hanifsulong commented on July 21, 2024

Here is the code that I use. Worked with v1.5 but not with higher version

Zip::create($zipfilename,[ storage_path('app/temp/shapefile/'.$filename.'.shp'), storage_path('app/temp/shapefile/'.$filename.'.shx'), storage_path('app/temp/shapefile/'.$filename.'.dbf') ])->saveTo(storage_path('app/temp/zip'));

from laravel-zipstream.

jszobody avatar jszobody commented on July 21, 2024

Are you by chance on Windows? Can you tell me what that storage_path('app/temp/zip') evaluates to? I'm particularly interested in the beginning of the path, whether it is a / or something like c:/.

from laravel-zipstream.

hanifsulong avatar hanifsulong commented on July 21, 2024

Yeah. I'm using Windows. It is a full path to laragon folder starting with C:/.

from laravel-zipstream.

jszobody avatar jszobody commented on July 21, 2024

Ok try this:

use STS\ZipStream\Models\LocalFile;

Zip::create($zipfilename, [
    storage_path('app/temp/shapefile/'.$filename.'.shp'), 
    storage_path('app/temp/shapefile/'.$filename.'.shx'), 
    storage_path('app/temp/shapefile/'.$filename.'.dbf') 
])->saveTo(new LocalFile(storage_path('app/temp/zip')));

from laravel-zipstream.

jszobody avatar jszobody commented on July 21, 2024

Or you can upgrade to v2.2 and try again with your original code. I believe that should work for you now, though I don't have a Windows machine myself to try it out. Let me know.

from laravel-zipstream.

hanifsulong avatar hanifsulong commented on July 21, 2024

I upgraded to v2.2 using the original code, I still got the same error.

The code you gave is not working, I got permission denied error

use STS\ZipStream\Models\LocalFile;

Zip::create($zipfilename, [ storage_path('app/temp/shapefile/'.$filename.'.shp'), storage_path('app/temp/shapefile/'.$filename.'.shx'), storage_path('app/temp/shapefile/'.$filename.'.dbf') ])->saveTo(new LocalFile(storage_path('app/temp/zip')));

So, I tried to put the filename into the saveTo path and its working perfectly!

use STS\ZipStream\Models\LocalFile;

Zip::create($zipfilename, [ storage_path('app/temp/shapefile/'.$filename.'.shp'), storage_path('app/temp/shapefile/'.$filename.'.shx'), storage_path('app/temp/shapefile/'.$filename.'.dbf') ])->saveTo(new LocalFile(storage_path('app/temp/zip/'.$zipfilename)));

I'm so glad I can use the latest version, otherwise I have to copy v1.5 from my older project :D
Thanks sir for your respond!

from laravel-zipstream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.