Comments (10)
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.
Hi @MikeMaldini ,
Can you provide more detail like your Nginx settings, laravel version, error message or any other information?
from laravel-swoole.
@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.
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.
@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.
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.
@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.
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.
@emielmolenaar Thanks
from laravel-swoole.
@albertcht Ye,i find some solution, anyway thanks due
from laravel-swoole.
Related Issues (20)
- Swoole Kill Process Without Waiting For Http Call
- How did I know swoole is succefull applied on my environment HOT 1
- streamDownload not working and sometimes also throw "allowed memory size ... exhausted" HOT 2
- high latency after loop
- can a controller run out swoole HOT 1
- Err in line 8 of tests/fixtures/bootstrap/app.php
- Auth user problem on web socket connection HOT 1
- auth user class redis not fund
- [Question] How to change default base_path so file upload $directory will be default on public folder rather than the root laravel folder? HOT 2
- Socket.io client not work with Websockets implementation out of box
- timer
- 调用chatgpt的流式响应输出有问题 HOT 1
- 为什么在使用websocket服务时,触发on connect回调的时候发送消息给指定userid的人,自己也会收到消息 HOT 1
- facades are not safe to use inside coroutine for sure in this package. HOT 1
- swoole HOT 1
- 响应时间较长的接口出现504或者502,后台程序则依然正常执行
- how to make views folder uploaded on ram ?
- Will it support laravel 11.x in future?
- sock instead of webhost
- please update for predis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-swoole.