Code Monkey home page Code Monkey logo

Comments (10)

emielmolenaar avatar emielmolenaar commented on May 18, 2024 3

Check out https://laravel.com/docs/5.6/requests#storing-uploaded-files and https://laravel.com/docs/5.6/filesystem . Use of Laravel's filesystem is encouraged over your own (kinda messy...) implementation.

from laravel-swoole.

albertcht avatar albertcht commented on May 18, 2024

Hi @MikeMaldini ,

Can you provide more detail like your Nginx settings, laravel version, error message or any other information?

from laravel-swoole.

MikeMaldini avatar MikeMaldini commented on May 18, 2024

@albertcht Yes i find some problem, when i didn't use proxy, i upload file it will upload in /public/storage/.. ( because its laravel's php artisan storage:link ) , But when i use proxy its will upload to /storage/ folder, it should be /storage/app/public/... , that's what i found, can you tell me how to fix this folder problem?

from laravel-swoole.

albertcht avatar albertcht commented on May 18, 2024

Hi @MikeMaldini ,

Do you mean your uploading works properly using this package but without Nginx proxy? If yes, I think you still need to provide your Nginx settings.

from laravel-swoole.

MikeMaldini avatar MikeMaldini commented on May 18, 2024

@albertcht That's my nginx config

# Default server configuration
#
map $http_upgrade $connection_upgrade {
    
	default upgrade;
    	
	'' close;
}

server {
	server_tokens off; # Hidden Server Version

	add_header X-Xss-Protection "1; mode=block"; # XSS Protect Header

	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; # HSTS Header
	
	root /var/www/Personal.Blog/public;

	# Add index.php to the list if you are using PHP
	index index.php index.html index.htm index.nginx-debian.html;

	server_name mikeblog.site;

	location = /index.php {
        # Ensure that there is no such file named "not_exists"
        # in your "public" directory.
       	try_files /not_exists @swoole;
    }

    location / {
        try_files $uri $uri/ @swoole;
    }

    location @swoole {
        set $suffix "";

        if ($uri = /index.php) {
                set $suffix "/";
        }

        proxy_set_header Host $host;
        proxy_set_header SERVER_PORT $server_port;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

    # IF https
        proxy_set_header HTTPS "on";

	proxy_temp_file_write_size  1000k;

        proxy_pass http://127.0.0.1:1215$suffix;
    }
}

from laravel-swoole.

albertcht avatar albertcht commented on May 18, 2024

Hi @MikeMaldini ,

I test my upload feature with the same Nginx config, and the file goes to correct location app/storage/....

Probably nothing to do with Nginx config, can you provide partial code about your upload logic?

from laravel-swoole.

MikeMaldini avatar MikeMaldini commented on May 18, 2024

@albertcht Yes, its my code, i use Intervention/image image package

...
$Str_Path_High = strtolower('STORAGE') . '/' . 'Original' . '/';
$Arr_Path['High'] = $Str_Path_High . $Str_Encrypt_FileName;
if( is_dir( $Str_Path_High ) == false ) mkdir( $Str_Path_High );
$Obj_Image_High = Image::make( $StrObj_File ) ->save( $Arr_Path['High'] );
...

from laravel-swoole.

albertcht avatar albertcht commented on May 18, 2024

Hi @MikeMaldini ,

Sorry for having difficulty finding any clues out from your code. Maybe you can try to dump the value of $Arr_Path['High']?

from laravel-swoole.

MikeMaldini avatar MikeMaldini commented on May 18, 2024

@emielmolenaar Thanks

from laravel-swoole.

MikeMaldini avatar MikeMaldini commented on May 18, 2024

@albertcht Ye,i find some solution, anyway thanks due

from laravel-swoole.

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.