tianyunperfect 1 tahun lalu
induk
melakukan
6ab5898a52
1 mengubah file dengan 17 tambahan dan 0 penghapusan
  1. 17 0
      sh_config.sh

+ 17 - 0
sh_config.sh

@@ -322,4 +322,21 @@ memo() {
     else
         echo "失败" $response
     fi
+}
+
+function upload_file() {
+    file_path=$1
+    if [ -z "$file_path" ]; then
+        echo "Error: 请传入文件路径"
+        return 1
+    fi
+    if [ ! -f "$file_path" ]; then
+        echo "Error: 文件不存在"
+        return 1
+    fi
+    curl -k -X POST -F "file=@$file_path" https://web_history.tianyunperfect.cn/oss/upload_file
+    file_name=$(basename "$file_path")
+    echo ''
+    echo "https://alist.tianyunperfect.cn/oss_gang/file/$file_name"
+    echo "https://tianyunperfect.oss-cn-hongkong.aliyuncs.com/file/$file_name"
 }