首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏实用技术

    java发送post请求,使用multipart/form-data的方式传递参数--《优化》

    "testname"); textMap.put("type", "2"); //设置file的name,路径 Map<String, String> fileMap = new HashMap<String, String>(); fileMap.put("upfile", fileName); String contentType = "";//image/png String ret = formUpload(url, textMap, fileMap,contentType); System.out.println static String formUpload(String urlStr, Map<String, String> textMap, Map<String, String> fileMap = null) { String filename = fileMap.get("filename"); String upload =

    6.1K20编辑于 2022-01-11
  • 来自专栏MyTechnology

    Java自动重启jar包

    { File[] files = FileUtil.ls(System.getProperty("user.dir")); HashMap<Long, String> fileMap for (File file : files) { if (file.getName().endsWith(".jar")) { fileMap.put (file.lastModified(), file.getName()); } } Set<Long> longs = fileMap.keySet (); Long max = Collections.max(longs); System.out.println(fileMap.get(max)); ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "start", "java", "-jar", fileMap.get(max));

    2.8K20发布于 2020-07-31
  • 来自专栏分享干货的你

    springboot 自定义配置解析器

    Map<String, Object> result = new HashMap<>(); // 获取json格式的Map Map<String, Object> fileMap JSONObject.parseObject(readFile(resource),Map.class); // 组装嵌套json processorMap("", result, fileMap } private void processorMap(String prefix, Map<String, Object> result, Map<String, Object> fileMap "; } for (Map.Entry<String, Object> entrySet : fileMap.entrySet()) { if (

    1.4K20发布于 2021-04-06
  • 来自专栏棒棒小飞人

    Java模拟表单post提交,可支持图片上传

    /** * 模拟表单post * * @param textMap 文本域 * @param fileMap 文件 * */ public static String postForm(String urlStr, Map<String, String> textMap, Map<String, String> fileMap) throws IOException { String res } out.write(strBuf.toString().getBytes()); } // file if (fileMap = null) { Iterator iter = fileMap.entrySet().iterator(); while (iter.hasNext(

    1.7K00发布于 2021-09-23
  • 来自专栏分享干货的你

    springboot 自定义加载配置文件2

    Map<String, Object> result = new HashMap<>(); // 获取json格式的Map Map<String, Object> fileMap JSONObject.parseObject(readFile(),Map.class); // 组装嵌套json processorMap("", result, fileMap } private void processorMap(String prefix, Map<String, Object> result, Map<String, Object> fileMap "; } for (Map.Entry<String, Object> entrySet : fileMap.entrySet()) { if (

    87810发布于 2021-04-06
  • 来自专栏Golang语言社区

    golang文件传输服务

    服务器启动时首先调用loadfile将文件导入到内存中,然后根据定义的key,将文件内容插入到字典filemap中: func loadfile(){ //从配置导入文件 F,err := = nil { fmt.Printf("config.txt open failed\n") return } filemap = make(map[string fmt.Printf("%s load error\n",fileconfig[0]) }else{ filemap success,key %s\n",fileconfig[0],fileconfig[1]) } } } } if filemap session\n") }else { filename,_ := rpk.String() filecontent := filemap

    2.3K50发布于 2018-03-26
  • 来自专栏全栈程序员必看

    Java使用HttpURLConnection上传文件

    > textMap = new HashMap<String, String>(); textMap.put("name", "testname"); Map<String, String> fileMap = new HashMap<String, String>(); fileMap.put("userfile", filepath); String ret = formUpload(urlStr , textMap, fileMap); System.out.println(ret); } /** * 上传图片 * @param urlStr * @param textMap * @param fileMap * @return */ public static String formUpload(String urlStr, Map<String, String > textMap, Map<String, String> fileMap) { String res = ""; HttpURLConnection conn = null; String

    2.6K20编辑于 2022-07-07
  • 来自专栏g歌德a

    Java微信公众平台开发(七)--多媒体消息回复之图片回复

    ** 34 * 上传图片 35 * 36 * @param urlStr 37 * @param textMap 38 * @param fileMap out.write(strBuf.toString().getBytes()); 76 } 77 78 // file 79 if (fileMap > iter = fileMap.entrySet().iterator(); 81 while (iter.hasNext()) { 82 new HashMap<String, String>(); 14 textMap.put("name", "testname"); 15 Map<String, String> fileMap = new HashMap<String, String>(); 16 fileMap.put("userfile", filepath); 17 String mediaidrs

    1.3K31发布于 2019-09-18
  • 来自专栏计算机图形学 前端可视化 WebGL

    WebGL加载本地模型

    files.length) return; console.log(files); let rootFile; const fileMap = new Map(); Array.from(files).forEach((file) => fileMap.set(file.name, file)); Array.from (fileMap).forEach(([path, file]) => { if (file.name.match(/\. const fileUrl = URL.createObjectURL(rootFile); const gltf = await load(fileUrl, rootPath, fileMap

    2.4K30编辑于 2022-05-11
  • 来自专栏学习java的小白

    springboot上传图片

    getFileURL(MultipartHttpServletRequest multipartRequest, String keys){ Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); return getPathValue(fileMap.get(keys),StaticUrl.getUrl());

    5.6K10发布于 2020-12-07
  • 来自专栏全栈程序员必看

    python遍历本地文件系统 按文件大小排序

    对字典使用sorted会返回一个元祖list 好了,基本的函数都讲完了,下面附上例子的相应代码: # -*-coding:utf-8-*- import os filePath = ‘D:\temp’ fileMap os.path.join(parent, filename)) size = os.path.getsize(os.path.join(parent, filename)) fileMap.setdefault (os.path.join(parent, filename), size) filelist = sorted(fileMap.items(), key=lambda d: d[1], reverse

    1.5K30编辑于 2022-07-09
  • 来自专栏全栈程序员必看

    java发送邮件-模板

    log.debug("set mail body content success, mailBody = " + mailBody); } /** * 添加邮件附件,附件可为多个 * @param fileMap 文件绝对路径map集合 * @throws MessagingException */ public void setFileAffix(Map<String, String> fileMap throws MessagingException, UnsupportedEncodingException { // 获取附件 for (String file: fileMap.keySet 对象 BodyPart bp = new MimeBodyPart(); // 获取文件路径 String filePath = fileMap.get sendMailFileByTemplateWithCopyto(String[] receivers, String[] copyTos, String subject, Map<String, String> fileMap

    2.3K20编辑于 2022-08-28
  • 来自专栏Unity3d程序开发

    MFC根据前缀批量复制文件工具

    CString name = finder.GetFileName(); CString path = finder.GetFilePath(); pair<CString, CString> fileMap (name, path); CString sFile = fileMap.first; if (sFile.Find('.') ! = -1) { files.push_back(fileMap); } } finder.Close(); return files; } 2.2递归查找 即查找文件下所有与前缀相同的文件

    55810编辑于 2023-08-24
  • 来自专栏Java工程师成长之路

    HystrixCommand实战

    MultipartFile file = null; try { Map<String, MultipartFile> fileMap = ((MultipartHttpServletRequest) request).getFileMap(); if (fileMap ! = null && fileMap.size() ! = 0) { file = fileMap.values().iterator().next();

    1K20发布于 2019-09-10
  • 来自专栏跟着阿笨一起玩NET

    WinForm中使用XML文件存储用户配置及操作本地Config配置文件

    这个方法会在这个目录下产生一个副本文件(E:\App.config.config),   二、读取自定义本地文件的Config文件 ConfigurationManager.OpenMappedExeConfiguration(fileMap 先实例化一个ExeConfigurationFileMap对象,把物理地址赋值到它的 ExeConfigFilename 属性中; ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = @"E:\MySrc\db.config"; //再调用fileMap 实例化 config , 这样,操作的文件就是db.config文件了,也不会产生副本文件 Configuration config = ConfigurationManager.OpenMappedExeConfiguration (fileMap, ConfigurationUserLevel.None); //读写操作跟原来一样,不变 String str

    3.5K20发布于 2018-09-19
  • 来自专栏学习java的小白

    多文件上传公共方法

    multipartRequest, String[] keys,String systemPath,String path){ Map<String, MultipartFile> fileMap new String[keys.length]; for (int i=0;i<keys.length;i++) { vales[i]=getPathValue(fileMap.get

    1.2K10发布于 2020-12-07
  • 来自专栏HUC思梦的java专栏

    fckeditor的简单使用

    mr = (MultipartHttpServletRequest) request; // 获取值 支持多个 Map<String, MultipartFile> fileMap = mr.getFileMap(); // 遍历Map Set<Entry<String, MultipartFile>> entrySet = fileMap.entrySet

    84320发布于 2020-09-03
  • 来自专栏前端工程

    再次揭秘Copilot:sourcemap逆向分析

    extension.js.map"); const rawSourceMap = JSON.parse(mapFile.toString()); const nameMap = new Map(); const fileMap fileMap.has(m.source)) { fileMap.set(m.source, { start: m, }); } else { fileMap.set(m.source, { ...fileMap.get(m.source), end: m, }); p.node; const { line, column } = node.loc.start; // 处理路径 for (const [file, m] of fileMap.entries

    58420编辑于 2023-11-11
  • 来自专栏原创分享

    系统调用之mmap源码分析(基于linux1.2.13)

    . */ static struct vm_operations_struct file_shared_mmap = { NULL, /* open */ filemap_close, /* close */ filemap_unmap, /* unmap */ NULL, /* protect */ filemap_sync, /* sync */ NULL, /* advise */ filemap_nopage, /* nopage */ NULL, /* wppage */ filemap_swapout, /* swapout */ NULL, It's * essentially an early COW detection */ // 调文件系统的no_page函数,该函数在filemap.c中,address是虚拟地址,page 然后执行在mmap的时候设置的函数集中的filemap_nopage函数。

    2K40发布于 2019-07-30
  • 来自专栏学习java的小白

    ajax上传文件并且判断是否为空

    multipartRequest, String[] keys, String systemPath, String path){ Map<String, MultipartFile> fileMap new String[keys.length]; for (int i=0;i<keys.length;i++) { vales[i]=getPathValue(fileMap.get

    2.8K10发布于 2020-12-07
领券