国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

layui選擇多張圖片上傳多圖上傳到服務(wù)器保存

這篇具有很好參考價值的文章主要介紹了layui選擇多張圖片上傳多圖上傳到服務(wù)器保存。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

多圖上傳在一些特殊的需求中我們經(jīng)常會遇到,其實多圖上傳的原理大家都有各自的見解。對于Layui多圖上傳和我之前所說的通過js獲取文本框中的文件數(shù)組遍歷提交的原理一樣,只不過是Layui中的upload.render方法已經(jīng)幫我們封裝好了,我們只管調(diào)用即可,也就是說你選中了幾張圖片,那么將會向后臺請求與圖片張數(shù)相同的次數(shù),即為遍歷提交的方式。

前端:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test04.aspx.cs" Inherits="MyProject.Test04" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>多圖上傳</title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link href="/JS/layui/css/layui.css?v=1.0" rel="stylesheet" />
    <link href="/layuiadmin/style/admin.css?v=1.0" rel="stylesheet" />
    <%--以下兩條是彈confirm需要--%>
    <link href="/css/bootstrap.min.css?v=1.0" rel="stylesheet" />
    <link href="/CSS/jquery-confirm.css?v=1.0" rel="stylesheet" />
    <script src="/JS/jquery-3.4.1.js?v=1.0"></script>
    <script src="/JS/layui/layui.js?v=1.0"></script>
    <script src="/JS/jquery-confirm.js?v=1.0"></script>
</head>
<body>

    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form">
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <div class="layui-tab  layui-tab-card" lay-filter="component-tabs-card">
                                <div class="layui-tab-content">
                                <div class="layui-tab-item" style="display:block;">
                                    上傳附件
                                        <div class="layui-upload">
                                            <button type="button" class="layui-btn" id="multiple_img_upload">多圖片上傳</button>
                                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px; ">
                                                預(yù)覽:
                                            <div class="layui-upload-list" id="div-slide_show"></div>
                                            </blockquote>
                                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
            </div>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-input-block">
                    <div class="layui-footer" style="left: 0; height:66px;">
                        <button type="button" class="layui-btn sim_btn">提交</button>
                        <input type="button" id="btnReset" class="layui-btn layui-btn-primary" value="重置" />
                    </div>
                </div>
            </div>
            </form>

        </div>
    </div>
    </div>

    <input type="hidden" name="imgs" class="multiple_show_img" value="" /><%--用于保存多圖上傳的資源數(shù)組--%>

    <script type="text/javascript">
        //這里一定要設(shè)置全局變量,不然下面用的時候,未定義
        var multiple_images = [];
        var layer, form, laypage, laydate, upload, layedit, indexs, indexsMan, element;
        $(function () {
            layui.use(['form', 'layedit', 'upload'], function () {
                layedit = layui.layedit,
                    form = layui.form,
                    upload = layui.upload;
                
                //多圖片上傳
                upload.render({
                    elem: '#multiple_img_upload'
                    , url: "/ASHX/SetImg.ashx?actionMore=MoreIMG"
                    , multiple: true
                    , before: function (obj) {
                        
                        var files = obj.pushFile(); //將每次選擇的文件追加到文件隊列
                        //var len = getJsonLength(files);
                        var fileAllNum = 10;//允許每次上傳附件的數(shù)量
                        var yishangchuan = $('.multiple_show_img').val();//已經(jīng)上傳完的圖片的路徑集合,多個以,號分隔
                        var arrImgNum = 0;//計算出共幾張圖
                        if (yishangchuan != "") {
                            if (yishangchuan.indexOf(",") > 0) {//如果有至少2張圖片
                                arrImgNum = yishangchuan.split(',').length;//計算出共幾張圖
                            }
                        }
                        //arrImgNum = arrImgNum == arrImgNum ? 2 : arrImgNum;
                        //alert(arrImgNum);
                        //alert(len);
                        //alert(fileAllNum);
                        if (arrImgNum < fileAllNum) {
                            //預(yù)讀本地文件示例,不支持ie8 
                            obj.preview(function (index, file, result) {
                                $('#div-slide_show').append('<img src="' + result + '"  id="' + file.name + '"  name="' + file.name + '"  alt="' + file.name + '"  title="點擊刪除" class="layui-upload-img" style="width: 100px;height: 100px;" onclick="delMultipleImgs(this)" onmouseover="imgover(this)" onmouseout="imgout(this)" />&nbsp;')
                                delete files[index];//刪除列表中已經(jīng)上傳過的對應(yīng)的文件,一般在某個事件中使用;防止重復(fù)上次預(yù)覽的數(shù)據(jù)進(jìn)行的提交問題。
                            });
                        }
                        else {
                            layer.msg("上傳文件最大不允許超過" + fileAllNum + "個");
                            return false;
                        }
                    }
                    , done: function (res) {
                        //如果上傳成功
                        //alert(index);
                        if (res.State == true) {
                            //追加圖片成功追加文件名至圖片容器1647508248937-0 1647508263902-0 1647508248937-0
                            //alert(res.Data);
                            multiple_images.push(res.Data);
                            $('.multiple_show_img').val(multiple_images);//把多選擇的圖片的地址統(tǒng)一放這里

                            //$('.multiple_show_img').val("");
                            //multiple_images = [];
                            //delete this.files[index];
                        } else {
                            //提示信息
                            layer.msg(res.Message);
                        }
                    }
                });
                //多圖片上傳

            });//對應(yīng)layui.use(['index', 'layer', 'form', 'laypage', 'laydate', 'upload', 'jquery', 'layedit'], function () {


            //提交表單
            $("body").on("click", ".sim_btn", function () {
                SaveData();
            });

        });//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {//對應(yīng)$(function () {


        function SaveData() {//
            /上傳附件開始/

            var uploadFiles = $('.multiple_show_img').val();//把上傳附件多選擇的圖片的地址統(tǒng)一放這里
            alert(uploadFiles);
            return false;
            /上傳附件結(jié)束/

            //if (names == "") {
            //    errorMsg = "請輸入姓名";
            //}
            //alert(errorMsg);
            //return false;
            if (errorMsg != "") {
                layer.msg(errorMsg, { icon: 7 });
                return false;
            } else {
                loadIndex = layer.load(0);
                var url = "/ClinicalControl/Case_ADD.aspx";
                var data = {
                    'action': 'SaveData'
                    , 'id': id
                    , 'uploadFiles': uploadFiles
                    , 'updateCRIDMan': updateCRIDMan
                    //, 'test': test 
                    //, 'test': test 
                }
                $.ajax({//
                    type: "POST",
                    url: url,
                    dataType: "JSON",
                    data: data,
                    success: function (result) {
                        if (result.State) {
                            layer.close(loadIndex);
                            if (result.Data != "") {
                                layer.msg(result.Data, { icon: 7 });
                            }
                            else {
                                layer.msg("操作成功", { icon: 6 });
                            }
                            setTimeout(closeRefresh, 1000);//關(guān)閉當(dāng)前iframe,刷新指定iframe
                        }
                        else {
                            layer.msg(result.Data, { icon: 7 });
                        }
                    }, complete: function (result) {
                        layer.close(loadIndex);
                    }
                });
            }

        }

        //單擊圖片刪除圖片 【注冊全局函數(shù)】
        function delMultipleImgs(this_img) {
            $.confirm({
                title: '提示',
                content: '確定要刪除嗎?',
                confirm: function () {
                    //獲取下標(biāo)
                    var subscript = $("#div-slide_show img").index(this_img);
                    //刪除圖片
                    this_img.remove();
                    //刪除數(shù)組
                    multiple_images.splice(subscript, 1);
                    //重新排序
                    multiple_images.sort();
                    $('.multiple_show_img').val(multiple_images);
                },
                cancel: function () {
                    layer.msg("操作取消", { icon: 6 });
                }
            });
            
            //返回
            return;
        }
        //上傳附件鼠標(biāo)懸停提示框
        function openMsg01(tempid) {
            subtips01 = layer.tips('點擊圖片刪除', '#div-slide_show', { tips: [1, '#ff6700'], time: 30000 });
        }
        //鼠標(biāo)懸停提示框
        function imgover(img) {
            openMsg01("");
        }
        function imgout(img) {
            layer.close(subtips01);
        }

    </script>
</body>
</html>

/ASHX/SetImg.ashx文件

using Common;
using Model;
using System;
using System.Drawing;
using System.IO;
using System.Web;

namespace MyProject.ASHX
{
    /// <summary>
    /// SetImg 的摘要說明
    /// </summary>
    public class SetImg : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string action = "";
            string actionMore = "";
            context.Response.ContentType = "text/plain";
            if (context.Request.Form["action"]!=null)
            {
                action = context.Request.Form["action"].ToString();//AJAX傳參
            }
            if (context.Request["actionMore"] != null)
            {
                actionMore = context.Request["actionMore"].ToString();//URL傳參
            }
            
            switch (action)
            {
                case "ConvertIMG":
                    ConvertIMG(context);
                    break;
                default:
                    break;
            }
            switch (actionMore)//多圖上傳
            {
                case "MoreIMG":
                    MoreIMG(context);
                    break;
                default:
                    break;
            }


        }

        /// <summary>
        /// 單張圖片上傳
        /// </summary>
        /// <param name="context"></param>
        public void ConvertIMG(HttpContext context)
        {
            string imgurl = context.Request.Form["imgurl"].ToString();
            string strFilePath = "";
            string strReturnFilePath = "";//返回前端的路徑,用于存入SQL
            string imgname = "";
            if (imgurl.IndexOf("data:image") >= 0)
            {
                string base64 = imgurl.Split(',')[1];//規(guī)范化,逗號前面的是標(biāo)識符,用于說明原圖片的名字和格式
                string path = context.Server.MapPath("/");//獲取網(wǎng)站的根路徑
                string strRand = PublicHelper.RanStr(10, true);
                string strSuffix = ".jpg"; //文件的后綴名根據(jù)實際情況
                strReturnFilePath = "\\UploadFile\\" + System.DateTime.Now.Year.ToString() + "\\" + System.DateTime.Now.Month.ToString() + "\\" + System.DateTime.Now.Day.ToString() + "\\";
                string strPath = path + strReturnFilePath;//在本地硬盤的絕對路徑
                imgname = strRand + strSuffix;
                if (!System.IO.Directory.Exists(strPath))
                {
                    System.IO.Directory.CreateDirectory(strPath);
                }
                //string local = "UploadFile\\" + System.DateTime.Now.Year.ToString() + "\\" + System.DateTime.Now.Month.ToString() + "\\" + System.DateTime.Now.Day.ToString() + "\\";
                //strFilePath = "/UploadFile/" + DateTime.Now.ToString("yyyyMMdd") + strRand + strSuffix;
                strFilePath = strPath.Trim().Replace("\\", "/");
                strReturnFilePath = strReturnFilePath.Trim().Replace("\\", "/") + imgname;
                MemoryStream stream = new MemoryStream(Convert.FromBase64String(base64));
                Bitmap bit = new Bitmap(stream);
                bit.Save(strPath + imgname);//保存圖片到本地
            }

            ResultInfo resultInfo = new ResultInfo() { State = false };
            if (strFilePath != "")
            {
                resultInfo.Data = strReturnFilePath;
                resultInfo.State = true;
            }
            string resultJson = JsonHelper.ObjectToJSON(resultInfo);
            context.Response.Write(resultJson);
            context.Response.End();
        }

        /// <summary>
        /// 多張圖片上傳
        /// </summary>
        /// <param name="context"></param>
        public void MoreIMG(HttpContext context)
        {
            string strFilePath = "";
            if (context.Request.Files.Count > 0)
            {
                //HttpPostedFile f = context.Request.Files[0];
                //f.SaveAs(context.Server.MapPath(f.FileName));

                ResultInfo resultInfo = new ResultInfo() { State = false };
                int isCheck = 0;//上傳附件是否通過驗證
                var file = context.Request.Files[0];
                string extension = System.IO.Path.GetExtension(file.FileName);//獲取文件后綴名FileSize
                string strFileExtension = PublicHelper.GetValue("FileExtension");//配置文件允許上傳的附件類型
                string strFileSize = PublicHelper.GetValue("FileSize");//配置文件允許上傳的附件類型

                if (strFileExtension.IndexOf(extension.ToLower()) < 0)
                {
                    isCheck = 1;
                    resultInfo.Message = "不支持此附件類型";
                }
                if (file.ContentLength > Convert.ToInt32(strFileSize))
                {
                    isCheck = 1;
                    resultInfo.Message = "上傳附件過大";
                }
                if (isCheck == 0)
                {
                    //定義本地路徑位置
                    string local = "UploadFile\\" + System.DateTime.Now.Year.ToString() + "\\" + System.DateTime.Now.Month.ToString() + "\\" + System.DateTime.Now.Day.ToString() + "\\";
                    //string filePathName = string.Empty;
                    string localPath = Path.Combine(HttpRuntime.AppDomainAppPath, local);

                    //var tmpName = HttpContext.Current.Server.MapPath("~/UploadFile/" + strCFID + "/" + System.DateTime.Now.ToString("yyyyMMdd") + "/");
                    //var tmp = file.FileName;
                    //var tmpIndex = 0;

                    //不帶路徑的最終文件名
                    string strRand = PublicHelper.RanStr(10, true);
                    string filePathName = strRand + PublicHelper.FilterSQL(file.FileName);//過濾文件名中的SQL敏感字符
                    if (!System.IO.Directory.Exists(localPath))
                    {
                        System.IO.Directory.CreateDirectory(localPath);
                    }
                    //if (System.IO.Directory.Exists(localPath))
                    //{
                    //    string a1 = "";
                    //}
                    //else
                    //{
                    //    System.IO.Directory.CreateDirectory(localPath);
                    //}
                    string localURL = Path.Combine(local, filePathName);
                    file.SaveAs(Path.Combine(localPath, filePathName));   //保存圖片(文件夾)


                    resultInfo.Data = "/" + localURL.Trim().Replace("\\", "/"); 
                    resultInfo.State = true;
                    resultInfo.Message = "";
                }
                
                string resultJson = JsonHelper.ObjectToJSON(resultInfo);
                context.Response.Write(resultJson);
                context.Response.End();

            }

            //string imgurl = context.Request.Form["imgurl"].ToString();
            //if (imgurl.IndexOf("data:image") >= 0)
            //{
            //    string base64 = imgurl.Split(',')[1];//規(guī)范化,逗號前面的是標(biāo)識符,用于說明原圖片的名字和格式
            //    string path = context.Server.MapPath("/");//獲取網(wǎng)站的根路徑
            //    string strRand = PublicHelper.RanStr(10, true);
            //    string strSuffix = ".jpg"; //文件的后綴名根據(jù)實際情況
            //    string strPath = path + "\\UploadFile\\" + DateTime.Now.ToString("yyyyMMdd") + strRand + strSuffix;
            //    strFilePath = "/UploadFile/" + DateTime.Now.ToString("yyyyMMdd") + strRand + strSuffix;
            //    MemoryStream stream = new MemoryStream(Convert.FromBase64String(base64));
            //    Bitmap bit = new Bitmap(stream);
            //    bit.Save(strPath);//保存圖片到本地
            //}

            //ResultInfo resultInfo = new ResultInfo() { State = false };
            //if (strFilePath != "")
            //{
            //    resultInfo.Data = strFilePath;
            //    resultInfo.State = true;
            //}
            //string resultJson = JsonHelper.ObjectToJSON(resultInfo);
            //context.Response.Write(resultJson);
            //context.Response.End();
        }



        public bool IsReusable
        {
            get
            {
                return false;
            }
        }


    }
}

PublicHelper.RanStr(10, true);方法

        /// <summary>
        /// 獲取隨機字符串
        /// </summary>
        /// <param name="Length">生成長度</param>
        /// <param name="Sleep">是否要在生成前將當(dāng)前線程阻止以避免重復(fù)</param>
        /// <returns></returns>
        public static string RanStr(int Length, bool Sleep)
        {
            if (Sleep)
                System.Threading.Thread.Sleep(3);
            char[] Pattern = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
            string result = "";
            int n = Pattern.Length;
            System.Random random = new Random(~unchecked((int)DateTime.Now.Ticks));
            for (int i = 0; i < Length; i++)
            {
                int rnd = random.Next(0, n);
                result += Pattern[rnd];

            }
            return result;
        }

PublicHelper.FilterSQL(file.FileName);

        /// <summary>
        /// 后臺過濾SQL關(guān)鍵字
        /// </summary>
        /// <param name="str">參數(shù)SQL語句</param>
        /// <returns></returns>
        public static string FilterSQL(string str)
        {
            //string filterSQL = "'|and|exec|insert|select|delete|update|count | *|%| chr | mid | master | truncate | char | declare |;| or | -| + | ,";
            string filterSQL = "exec|insert|delete|update|count|*|chr|mid|master|truncate|char|declare|;";
            string[] strArray = filterSQL.Split('|');

            for (int i = 0; i < strArray.Length; i++)
            {
                if (str.IndexOf(strArray[i]) >= 0)
                {
                    str = str.Replace(strArray[i], "");
                }
            }
            return str;
        }

配置文件文章來源地址http://www.zghlxwxcb.cn/news/detail-566972.html

<?xml version="1.0" encoding="utf-8"?>
<appSettings>
  <!--允許上傳的附件類型-->
  <add key="FileExtension" value=".jpg.jpeg.gif.png.bmp" />
  <!--允許每次上傳附件的大小,以byte為單位,1048576是一M。-->
  <add key="FileSize" value="10485760" />
  <!--允許批量上傳附件的數(shù)量-->
  <add key="FileAllNum" value="3" />

  
</appSettings>

到了這里,關(guān)于layui選擇多張圖片上傳多圖上傳到服務(wù)器保存的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • [小程序]向服務(wù)器上傳圖片和從服務(wù)器下載圖片

    [小程序]向服務(wù)器上傳圖片和從服務(wù)器下載圖片

    本例的服務(wù)器基于flask,配置flask可以參見 [Flask]上傳多個文件到服務(wù)器 https://blog.csdn.net/weixin_37878740/article/details/128435136?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522170581653516800185854860%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257Drequest_id=170581653516800185854860biz_id=0utm_m

    2024年02月20日
    瀏覽(28)
  • halo --- 上傳圖片服務(wù)器錯誤

    halo --- 上傳圖片服務(wù)器錯誤

    ? ?上傳圖片時,報錯服務(wù)器錯誤(包括上傳附件、博客文章插入圖片、上傳相冊) ? 1、查看日志 報錯的是數(shù)據(jù)庫操作異常 但是檢查數(shù)據(jù)庫后確認(rèn)了數(shù)據(jù)庫是正常在跑 ? 2、再次上傳一張小一點的圖片 ? ?發(fā)現(xiàn)上傳成功了 猜測是受到了nginx的上傳文件大小的限制 ? 3、檢查

    2024年02月13日
    瀏覽(24)
  • 前后端服務(wù)器分離時,前端如何上傳圖片到前端服務(wù)器?

    當(dāng)前后端服務(wù)器分離時,前端上傳圖片到前端服務(wù)器可以采用以下幾種方式: 1. 直接上傳到前端服務(wù)器:可以通過使用HTML的`input type=\\\"file\\\"`元素,讓用戶選擇圖片文件并直接上傳到前端服務(wù)器。前端服務(wù)器可以使用后端提供的API接口處理上傳請求,然后將圖片保存到前端服務(wù)

    2024年04月27日
    瀏覽(98)
  • UE4-上傳圖片到服務(wù)器

    UE4-上傳圖片到服務(wù)器

    由于 VaRest 插件無法滿足我們上傳表單的需求,在這里需要使用其他庫方法。 優(yōu)點: httplib 庫是一個以 C++11 特性編寫的庫,所以編譯器也需要能支持 C++11 的。庫在使用時只需包含一個頭文件即可,非常方便。 缺點: 此庫為線程阻塞,使用時還請注意。 由于上傳圖片需要提

    2024年02月07日
    瀏覽(33)
  • 13、微信小程序:上傳圖片到服務(wù)器

    13、微信小程序:上傳圖片到服務(wù)器

    1、上傳圖片到服務(wù)器,有兩個步驟: ? ? 1.1? 拿到可上傳的圖片?wx.chooseImage ????1.2? 將圖片上傳到服務(wù)器??wx.uploadFile 2、代碼實現(xiàn) button?bindtap=\\\"upload\\\"點擊上傳/button image?src=\\\"{{imgPath}}\\\"?mode=\\\"\\\"/

    2024年02月12日
    瀏覽(99)
  • vue2使用 tinymce富文本編輯器-圖片上傳、粘貼圖片上傳致服務(wù)器

    1.安裝tinymce富文本編輯器插件 npm i tinymce npm i @tinymce/tinymce-vue 2.創(chuàng)建Editor.js文件 封裝組件 以便使用 3.漢化包 (我放在public/tynymce/langs文件夾里) 4.vue組件中使用 本次記錄重點在于 上傳圖片方法 需要區(qū)分工具欄中圖片上傳方法 以及 粘貼進(jìn)去的圖片也需要走上傳方法。兩個方

    2024年02月09日
    瀏覽(97)
  • Unity向Web服務(wù)器上傳和下載圖片

    Unity向Web服務(wù)器上傳和下載圖片

    Unity的WWW不但能上傳下載文本形式的數(shù)據(jù),還可以上傳下載圖片,不過在傳輸過程中,圖片的信息需要轉(zhuǎn)為文本格式。 在上傳的這段代碼中,我們使用EncodeToPNG函數(shù)將圖片轉(zhuǎn)出為byte數(shù)組,使用WWWForm的方式上傳到Web服務(wù)器上,與之前不同的是,這一次上傳的PNG格式的圖片。當(dāng)上

    2024年02月03日
    瀏覽(23)
  • Vue中實現(xiàn)圖片上傳,上傳后的圖片回顯,存儲圖片到服務(wù)器 【使用對象存儲OSS】

    Vue中實現(xiàn)圖片上傳,上傳后的圖片回顯,存儲圖片到服務(wù)器 【使用對象存儲OSS】

    前言 以下只提供一種思路,對新手可能不太友好。 這里將前端Vue上傳的圖片直接存儲到服務(wù)器上, Alibaba Cloud OSS : 阿里云對象存儲服務(wù)(Object Storage Service,簡稱 OSS),是阿里云提供的海量、安全、低成本、高可靠的云存儲服務(wù)。您可以在任何應(yīng)用、任何時間、任何地點存儲

    2024年02月06日
    瀏覽(124)
  • js將項目中的圖片上傳到服務(wù)器

    項目上有時候會有奇怪的需求,比如前端有一些示例,想點擊按鈕就能上傳圖片,而這個圖片是在前端的項目中的,如果不上傳吧,又獲取不到一些業(yè)務(wù)數(shù)據(jù)的id,但后端又不想為這塊功能做特殊的處理,這時想通過前端直接上傳到后端,需要file對象才可以。 這個時候我們需

    2024年02月12日
    瀏覽(21)
  • vue3 + fastapi 實現(xiàn)選擇目錄所有文件自定義上傳到服務(wù)器

    vue3 + fastapi 實現(xiàn)選擇目錄所有文件自定義上傳到服務(wù)器

    大家好,我是yma16,本文分享關(guān)于vue3 + fastapi 實現(xiàn)選擇目錄文件上傳到服務(wù)器指定位置。 vue3系列相關(guān)文章: 前端vue2、vue3去掉url路由“ # ”號——nginx配置 csdn新星計劃vue3+ts+antd賽道——利用inscode搭建vue3(ts)+antd前端模板 認(rèn)識vite_vue3 初始化項目到打包 python_selenuim獲取csdn新星

    2024年02月08日
    瀏覽(18)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包