Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
huawuhen opened this issue Feb 21, 2024 · 5 comments
Open

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

huawuhen opened this issue Feb 21, 2024 · 5 comments

Comments

@huawuhen
Copy link

由于项目介绍没说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
@dcdebug
Copy link

dcdebug commented Feb 24, 2024

HTTPS 证书过期

@dcdebug
Copy link

dcdebug commented Mar 1, 2024

HTTPS 证书过期

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

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

@huawuhen
Copy link
Author

huawuhen commented Mar 6, 2024

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

@zhongyuanqi
Copy link

zhongyuanqi commented Mar 21, 2024

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

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

@huawuhen
Copy link
Author

huawuhen commented Mar 24, 2024

已通过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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants