找回密码
 立即注册
查看: 39|回复: 0

[流程系列] 大佬帮忙看看文件上传问题

[复制链接]

24

主题

308

回帖

1418

积分

金牌会员

积分
1418
金钱
1086
HASS币
10
发表于 昨天 17:02 | 显示全部楼层 |阅读模式
我用nodered做的文件上传到本地服务器,服务器上对应文件夹已设置所有人写入权限,但是上传文件时名称不对,文件也只有1k。帮忙看下哪里设置不对?折腾了几天还是不行

[
    {
        "id": "6b471d641a30d424",
        "type": "http in",
        "z": "9ff0cccf6bf87a80",
        "name": "",
        "url": "/upload",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 190,
        "y": 440,
        "wires": [
            [
                "9cd5a4a6661d21bc"
            ]
        ]
    },
    {
        "id": "9cd5a4a6661d21bc",
        "type": "template",
        "z": "9ff0cccf6bf87a80",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n<html lang="zh-CN">\n<head>\n    <meta charset="UTF-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <title>信息系统</title>\n    <style>\n        body {\n            font-family: 'Microsoft YaHei', Arial, sans-serif;\n            background-color: #f5f5f5;\n            margin: 0;\n            padding: 20px;\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            min-height: 100vh;\n        }\n        \n        .form-container {\n            background-color: white;\n            padding: 30px;\n            border-radius: 8px;\n            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n            width: 100%;\n            max-width: 500px;\n        }\n        \n        .header {\n            text-align: center;\n            margin-bottom: 25px;\n            border-bottom: 2px solid #4a90e2;\n            padding-bottom: 15px;\n        }\n        \n        .company-name {\n            font-size: 28px;\n            font-weight: bold;\n            color: #333;\n            margin-bottom: 5px;\n        }\n        \n        .company-name-en {\n            font-size: 14px;\n            color: #555;\n            margin-bottom: 10px;\n            font-style: italic;\n        }\n        \n        .system-title {\n            font-size: 18px;\n            font-weight: bold;\n            color: #4a90e2;\n            margin-top: 10px;\n        }\n        \n        .form-group {\n            margin-bottom: 20px;\n        }\n        \n        label {\n            display: block;\n            margin-bottom: 8px;\n            font-weight: bold;\n            color: #555;\n        }\n        \n        input[type="text"], \n        input[type="file"] {\n            width: 100%;\n            padding: 10px;\n            border: 1px solid #ddd;\n            border-radius: 4px;\n            font-size: 16px;\n            box-sizing: border-box;\n        }\n        \n        input[type="text"]:focus,\n        input[type="file"]:focus {\n            border-color: #4a90e2;\n            outline: none;\n            box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);\n        }\n        \n        textarea {\n            width: 100%;\n            height: 120px;\n            padding: 10px;\n            border: 1px solid #ddd;\n            border-radius: 4px;\n            font-size: 16px;\n            resize: vertical;\n            box-sizing: border-box;\n            font-family: inherit;\n        }\n        \n        textarea:focus {\n            border-color: #4a90e2;\n            outline: none;\n            box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);\n        }\n        \n        .radio-group {\n            display: flex;\n            gap: 20px;\n            margin-bottom: 15px;\n        }\n        \n        .radio-option {\n            display: flex;\n            align-items: center;\n        }\n        \n        .radio-option input {\n            margin-right: 8px;\n        }\n        \n        .file-upload-hint {\n            font-size: 14px;\n            color: #777;\n            margin-top: 5px;\n        }\n        \n        .submit-btn {\n            background-color: #4a90e2;\n            color: white;\n            border: none;\n            padding: 12px 20px;\n            font-size: 16px;\n            border-radius: 4px;\n            cursor: pointer;\n            width: 100%;\n            transition: background-color 0.3s;\n        }\n        \n        .submit-btn:hover {\n            background-color: #3a7bc8;\n        }\n\t\t.red-text {\n            color: red;\n        }\n    </style>\n</head>\n<body>\n    <div class="form-container">\n        <div class="header">\n            <div class="company-name">有限公司</div>\n            <div class="company-name-en">ALUMINUM Co., Ltd.</div>\n            <div class="system-title">信息系统</div>\n        </div>\n        <!-- 示例表单(参考) -->\n<form action="http://192.168.10.9:1880/upload" method="post" enctype="multipart/form-data">\n  <input type="file" name="image">\n  <button type="submit">上传</button>\n</form>\n    </div>\n</body>\n</html>",
        "output": "str",
        "x": 370,
        "y": 440,
        "wires": [
            [
                "4150555863819396"
            ]
        ]
    },
    {
        "id": "4150555863819396",
        "type": "http response",
        "z": "9ff0cccf6bf87a80",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 570,
        "y": 440,
        "wires": []
    },
    {
        "id": "60543975260ce890",
        "type": "debug",
        "z": "9ff0cccf6bf87a80",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 920,
        "y": 540,
        "wires": []
    },
    {
        "id": "a1b2c3d4.5678e9",
        "type": "http in",
        "z": "9ff0cccf6bf87a80",
        "name": "文件上传",
        "url": "/upload",
        "method": "post",
        "upload": true,
        "swaggerDoc": "",
        "x": 240,
        "y": 580,
        "wires": [
            [
                "3aaa9d5791aadc07"
            ]
        ]
    },
    {
        "id": "2cb0024379c56c90",
        "type": "http response",
        "z": "9ff0cccf6bf87a80",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 930,
        "y": 600,
        "wires": []
    },
    {
        "id": "939ff9ca62e5a0bd",
        "type": "function",
        "z": "9ff0cccf6bf87a80",
        "name": "function 3",
        "func": "msg.payload = {\n    status: 'success',\n    message: '文件已保存',\n    file: msg.payload.originalname\n};\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 740,
        "y": 580,
        "wires": [
            [
                "2cb0024379c56c90",
                "60543975260ce890"
            ]
        ]
    },
    {
        "id": "3aaa9d5791aadc07",
        "type": "file",
        "z": "9ff0cccf6bf87a80",
        "name": "",
        "filename": "D:\\nodered\\upload\\{{originalname}}",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": false,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 520,
        "y": 580,
        "wires": [
            [
                "939ff9ca62e5a0bd"
            ]
        ]
    }
]


flows (2).rar

1.93 KB, 下载次数: 1

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-5-17 13:20 , Processed in 0.282161 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表