Telegraph-Image icon indicating copy to clipboard operation
Telegraph-Image copied to clipboard

怎么用API上传,麻烦可以写清楚吗

Open huawuhen opened this issue 1 year ago • 5 comments

由于项目介绍没说API,我摸索出,API上传地址https://yuming.com/upload POST参数:file 可我写了一个批处理根本上传不了

@echo off
setlocal enabledelayedexpansion

REM 设置API上传接口和参数名
set upload_url=https://yuming.com/upload
set param_name=file

REM 设置图片文件夹路径
set image_folder=C:\Users\Administrator\Pictures\zzz

REM 创建一个空文件用于存储链接地址
echo. > image_links.txt

REM 循环遍历文件夹中的所有图片文件
for %%i in ("%image_folder%\*.*") do (
    echo Uploading %%i
    curl -s -F %param_name%=@%%i %upload_url% | findstr /C:"url" >> image_links.txt
)

echo Image upload completed

REM 显示链接地址
echo Image links:
type image_links.txt

pause

huawuhen avatar Feb 21 '24 08:02 huawuhen

HTTPS 证书过期

dcdebug avatar Feb 24 '24 09:02 dcdebug

HTTPS 证书过期

这个才是我的真实域名https://tu.homwei.link/upload 大佬帮忙指导下

建议:不要clone项目再上传cloudflare worker ,直接在worker中访问github导入(fork),前者操作有bug. 图床逻辑慢简单,实在不行自己撸一个。

dcdebug avatar Mar 01 '24 17:03 dcdebug

已通过AI成功找到方法,关闭

huawuhen avatar Mar 06 '24 07:03 huawuhen

已通过AI成功找到方法,关闭

能分享下成功的代码吗,感谢!

zhongyuanqi avatar Mar 21 '24 03:03 zhongyuanqi

已通过AI成功找到方法,关闭

能分享下成功的代码吗,感谢!

@echo off
set /p filepath="Enter the path to the image file: "
set response=%TEMP%\upload_response.txt
curl -X POST -F "file=@%filepath%" https://yourname.com/upload > "%response%"
set /p image_url=< "%response%"
echo Image URL: https://yourname.com/file%image_url:~16,-3%
pause

huawuhen avatar Mar 24 '24 00:03 huawuhen