Python3 uploads files to the php service interface?

python Code

import requests

url = "http://xxxx.cn/file"
files = {"file":open("demo.png", "rb")}
r = requests.post(url, files=files)
print(r.text)

php Code

<?php
    public function upload(Request $request)
    {
        $file = $request->file("file");
        Log::info(json_encode($file));
    }
?>        

returned data

local.INFO: {} 

ask the Great God for an answer?

Mar.20,2022

file? Files?


check to see if the file has been received first

dd($request->file());

check the python code without


because of the limited size of files uploaded by php, small files can be uploaded successfully.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4f41-1d15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4f41-1d15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?