import os, requests file_path = 'datamodel.png' file_name ='datamodel.png' file_type = 'image/jpeg' file_size = str(os.path.getsize(file_path)) # bắt buộc chuyển thành string user = 1 url = 'https://api.y99.vn/upload/' # 🔁 thay bằng URL thực tế #url = 'http://localhost:8000/upload/' # Mở ảnh và gửi form with open(file_path, 'rb') as f: files = { 'file': (file_name, f, file_type) } data = { 'filename': file_name, 'name': file_name, 'type': 'image', 'size': file_size, 'user': user, 'convert': "0" } response = requests.post(url, files=files, data=data) # In kết quả phản hồi từ server print("Status code:", response.status_code)