image-file 相关问题


如何在不重新加载页面的情况下发送带有文件的表单?

我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在...... 我有下一个表格: 我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在... 我有下一个表格: <form id="settings" method="POST" enctype="multipart/form-data"> ... <input type="file" id="logo" style="display:none;" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">save</button> </form> Ajax 脚本: $('#settings').submit(function(e){ e.preventDefault(); var form = $(this).serialize(); alert(form); // file is not attached... $.ajax({ url : '/settings', type : 'POST', crossDomain : false, data : form, contentType : 'multipart/form-data', dataType : 'json', progressData: false, cache : false, success : function(r){ alert (111); } }).fail(function(){ console.log('Error occured!'); }); }); 在服务器端,我收到错误: org.apache.tomcat.util.http.fileupload.FileUploadException:请求被拒绝,因为未找到多部分边界 我尝试不序列化表单,而是写了 data : form -> data : new FormData(this) 此选项会导致错误“非法调用”。如何在不重新加载页面的情况下发送带有文件的表单? 要使用 AJAX 发送带有文件的表单而不重新加载页面,您需要使用 FormData 来正确处理文件上传。 <form id="settings" method="POST" enctype="multipart/form-data"> <!-- Other form fields --> <input type="file" id="logo" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">Save</button> </form> $(document).ready(function() { $('#settings').submit(function(e){ e.preventDefault(); var formData = new FormData(this); $.ajax({ url: '/settings', type: 'POST', data: formData, contentType: false, processData: false, cache: false, success: function(response){ alert('Form submitted successfully!'); // Handle the response from the server }, error: function(){ console.log('Error occurred!'); } }); }); });


在这个curl api中将不记名授权令牌放在哪里

我正在使用 imageqrcode (https://imageqrcode.com/apidocumentation) 的新 api 功能来动态生成图像 QR 码,使用 php: 我正在使用 imageqrcode (https://imageqrcode.com/apidocumentation) 的新 api 功能来动态生成图像 QR 码,使用 php: <?php $api_key = 'xxxxxxxxxx'; //secret // instantiate data values $data = array( 'apikey' => $api_key, 'qrtype' => 'v1', 'color' => '000000', 'text' => 'https://wikipedia.com', ); // connect to api $url = 'https://app.imageqrcode.com/api/create/url'; $ch = curl_init($url); // Attach image file $imageFilePath = 'test1.jpg'; $imageFile = new CURLFile($imageFilePath, 'image/jpeg', 'file'); $data['file'] = $imageFile; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Handle the response $result = json_decode($response, true); if ($result && isset($result['downloadURL'])) { // Successful request $download_url = $result['downloadURL']; echo "Download URL: $download_url"; } else { // Handle errors echo "Error: " . print_r($result, true); } ?> 在文档中显示有变量“serialkey”: 图片二维码API文档 API文档 生效日期:2023年11月15日 图像二维码 API 是一项接受 HTTPS 请求以生成图像或 gif 二维码的服务,主要由开发人员使用。 图像二维码 - URL JSON 请求(POST):https://app.imageqrcode.com/api/create/url apikey //你的apikey 序列号//你的序列号 qrtype //字符串,最少 2 个字符,最多 2 个字符v1 或 v2,v1 适用于 QR 类型 1,v2 适用于类型 2 color //数字,最小 6 位,最大 6 位,例如000000 为黑色 text //url,最少 15 个字符,最多 80 个字符https://yourwebsite.com file //图像文件 (jpg/jpeg/png),最大 1 MB 文件大小 现在没有信息将该序列密钥作为标准承载授权令牌放在哪里???如果没有此信息,我无法连接到 api 我尝试在没有不记名令牌的情况下连接它,因为我认为它可以匿名连接到 api,但也不起作用,我现在很困惑,因为我仍在学习 PHP 和 Laravel 看起来 serialkey 不是不记名令牌,而是一个应该与其他参数(如 apikey、qrtype、color、text 和 )一起包含在 POST 数据中的参数file。您可以在 PHP 代码的 serialkey 数组中包含 $data。 $data = array( 'apikey' => $api_key, 'serialkey' => 'your_serial_key', // Add this line 'qrtype' => 'v1', 'color' => '000000', 'text' => 'https://wikipedia.com', );


使用 qr-image 生成 Wi-Fi QRCode

npm 模块 qr-image 允许使用 NodeJS 生成 QRCode,如下所示: 从“qr-image”导入 qr; 从 'fs' 导入 fs; qr.image('https://google.com/search?q=hello%20world!', {type:'...


PHP8 从函数返回 ZipArchive getStream 使得包含的 zip 存档被关闭

私有函数 getFilePointer($file) { $pathInfo = 路径信息($file); $zip = new ZipArchive(); if (($res = $zip->open($file)) !== true) { 抛出新的例外...


获取世博会资产

访问世博会资产的正确方法是什么? 我试过这个: 等待 Asset.loadAsync(require('file:///assets/data/catalog.json')); 错误: 无法解析“file:///assets/data/catalog.json”...


使用批处理脚本重命名多个文件

我有很多这种格式的文件: D:\images\AAA_BBB\image\whatever1.jpg D:\images\AAA_BBB\image\whatever2.jpg D:\images\FFF_EEE_CCC\图像 sdf1.jpg D:\images\FFF_EEE_CCC\图像 sdf2.jpg D:\我...


nuxt 3 中的 nuxt/image 模块导致生产出现问题

使用 Nuxt/Image 模块并构建应用程序时,图像 URL 将更改为 https://domain.x/_ipx/_/images/foods/Appetizaer/Garlic-Bread.png。然而,图像不能被看...


无法访问“<init>”:它在“Image”中是包私有的

Android studio,我想用内置方法“Image”发布一个简单的图像。编译器抛出了我在标题中发布的内容。 我正在尝试不同的图像选项和 ImageView 没有


从react-native-image-crop-picker录制视频在android 13 - Tab(三星Galaxy Tab A8)中不起作用

我在我的react-native应用程序中使用react-native-image-crop-picker并从Android中的相机录制视频它正在返回[错误:用户取消了图像选择] 笔记: 它正在工作...


使用“file:”包含本地 NPM 包时删除对等依赖项

如何对使用 package.json 中的 file: 模式安装的本地 NPM 包进行 NPM 重复数据删除对等依赖项?使用 npm 安装软件包时,对等依赖项会正确删除重复数据


一个js函数调用多个html canvas的draw和drawImage方法可以保存到单个Image对象中吗?

一个js函数调用多个html canvas的draw和drawImage方法可以保存到单个Image对象中吗? 一直在寻找一种方法来做到这一点。我正在考虑利用 html canvas cli...


编写一个程序,该程序本质上将代码文件复制到数组中,并将缩进保存到数组中以写出到单独的文件中

私有静态 StringTokenizer readFile(String inputFilename) 抛出 FileNotFoundException { 文件 file = new File(inputFilename); 扫描仪扫描仪=新扫描仪(文件); 字符串


通过更少的 Java API 调用来映射 Google 云端硬盘内容的有效方法

大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我做这样的事情: 哈希映射 大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我正在做这样的事情: HashMap<String, Strin> foldersPathToID = new HashMap<>(); //searching all folders first saving their IDs searchAllFoldersRecursive(folderName.trim(), driveId, foldersPathToID); //then listing files in all folders HashMap<String, List<File>> pathFile = new HashMap<>(); for (Entry<String, String> pathFolder : foldersPathToID.entrySet()) { List<File> result = search(Type.FILE, pathFolder.getValue()); if (result.size() > 0) { String targetPathFolder = pathFolder.getKey().trim(); pathFile.putIfAbsent(targetPathFolder, new ArrayList<>()); for (File file : result) { pathFile.get(targetPathFolder).add(file); } } } 递归方法在哪里: private static void searchAllFoldersRecursive(String nameFold, String id, HashMap<String, String> map) throws IOException, RefreshTokenException { map.putIfAbsent(nameFold, id); List<File> result; result = search(Type.FOLDER, id); // dig deeper if (result.size() > 0) { for (File folder : result) { searchAllFoldersRecursive(nameFold + java.io.File.separator + normalizeName(folder.getName()), folder.getId(), map); } } } 搜索功能是: private static List<com.google.api.services.drive.model.File> search(Type type, String folderId) throws IOException, RefreshTokenException { String nextPageToken = "go"; List<File> driveFolders = new ArrayList<>(); com.google.api.services.drive.Drive.Files.List request = service.files() .list() .setQ("'" + folderId + "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false") .setPageSize(100).setFields("nextPageToken, files(id, name)"); while (nextPageToken != null && nextPageToken.length() > 0) { try { FileList result = request.execute(); driveFolders.addAll(result.getFiles()); nextPageToken = result.getNextPageToken(); request.setPageToken(nextPageToken); return driveFolders; } catch (TokenResponseException tokenError) { if (tokenError.getDetails().getError().equalsIgnoreCase("invalid_grant")) { log.err("Token no more valid removing it Please retry"); java.io.File cred = new java.io.File("./tokens/StoredCredential"); if (cred.exists()) { cred.delete(); } throw new RefreshTokenException("Creds invalid will retry re allow for the token"); } log.err("Error while geting response with token for folder id : " + folderId, tokenError); nextPageToken = null; } catch (Exception e) { log.err("Error while reading folder id : " + folderId, e); nextPageToken = null; } } return new ArrayList<>(); } 我确信有一种方法可以通过很少的 api 调用(甚至可能是一个调用?)对每个文件(使用文件夹树路径)进行正确的映射,因为在我的版本中,我花了很多时间进行调用 service.files().list().setQ("'" + folderId+ "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false").setPageSize(100).setFields("nextPageToken, files(id, name)"); 每个子文件夹至少一次......并且递归搜索所有内容需要很长时间。最后,映射比下载本身花费的时间更多...... 我搜索了文档,也在此处搜索,但没有找到任何内容来列出具有一个库的所有驱动器调用任何想法? 我想使用专用的 java API 来获取共享 GoogleDrive 中的所有文件及其相对路径,但调用次数尽可能少。 提前感谢您的时间和答复 我建议您使用高效的数据结构和逻辑来构建文件夹树并将文件映射到其路径,如下所示 private static void mapDriveContent(String driveId) throws IOException { // HashMap to store folder ID to path mapping HashMap<String, String> idToPath = new HashMap<>(); // HashMap to store files based on their paths HashMap<String, List<File>> pathToFile = new HashMap<>(); // Fetch all files and folders in the drive List<File> allFiles = fetchAllFiles(driveId); // Build folder path mapping and organize files for (File file : allFiles) { String parentId = (file.getParents() != null && !file.getParents().isEmpty()) ? file.getParents().get(0) : null; String path = buildPath(file, parentId, idToPath); if (file.getMimeType().equals("application/vnd.google-apps.folder")) { idToPath.put(file.getId(), path); } else { pathToFile.computeIfAbsent(path, k -> new ArrayList<>()).add(file); } } // Now, pathToFile contains the mapping of paths to files // Your logic to handle these files goes here } private static List<File> fetchAllFiles(String driveId) throws IOException { // Implement fetching all files and folders here // Make sure to handle pagination if necessary // ... } private static String buildPath(File file, String parentId, HashMap<String, String> idToPath) { // Build the file path based on its parent ID and the idToPath mapping // ... }


canvas drawImage() 渲染 Font Awesome 图标

我需要使用画布drawImage()渲染字体很棒的图像。 drawImage 接受图像参数: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage#image 一个元素...


如何在SikuliX(Java)中单击当前鼠标位置?

这是我尝试过的: 屏幕 screenWithCalendarField = new Screen(); 比赛日历 = new Match(); 尝试{ 日历 = screenWithCalendarField.find(new File("D:\Sikuli\CalendarField.png").


如何获取当前正在执行的启动器的版本?

我目前的尝试是: 文件执行目录 = new File("").getCanonicalFile(); ApplicationInfo信息 = ApplicationRegistry.getApplicationInfoByDir(executionDir); 返回 info.getVersion(); 它...


React-Pixi 入口/react-pixi 中的屏蔽

我用于精灵的图像比所需的大得多(910px)。我需要动态更改容器的高度,遮盖图像。 有谁知道如何做到这一点? 我用于精灵的图像比所需的大得多(910 像素)。我需要动态更改容器的高度,遮盖图像。 有人知道该怎么做吗? <Container x={x} y={y} width={width} height={height}> <Sprite image={image} anchor={[0, 0]} x={0} y={0} width={width} height={910} rotation={0} /> </Container> @inlet/react-pixi: "^1.1.9" pixi.js: "^5.2.0" react: "^16.12.0" react-dom: "^16.12.0" 不幸的是,这也不起作用,因为纹理保持静态,而矩形四处移动 <Graphics draw={(g) => { g.clear() const texture = new PIXI.Texture.from(image) g.beginTextureFill(texture) g.drawRect(x, y, width, height) g.endFill() }} /> 试试这个: const maskRef = useRef() <Container mask={maskRef?.current} x={x} y={y} width={width} height={height}> <Graphics name="mask" draw={React.useCallback( (g) => { g.beginFill(0x000000) g.drawRect(0, 0, size.width + 3, size.height + 3) g.endFill() }, [width, height] )} ref={maskRef} /> <Sprite image={image} anchor={[0, 0]} x={0} y={0} width={width} height={910} rotation={0} /> </Container> 官方文档位于此处,解释其工作原理和局限性


org.apache.commons.logging.LogFactory 在构建时无意中初始化了

我正在使用 GraalVM 21、JDK 21、Ubuntu 22.04 LTS # 在 Ubuntu 22.04 操作系统 (WSL 2) 上 chmod +x mvnw ./mvnw -Pnative spring-boot:build-image 日志 [信息] [创建者] - '-H:+


jq 如何获取特定孩子的所有父母

您好,我有以下 json 并尝试获取所有拥有“linux-image-amd64”的父母 { "web-prode-01.example.de": "错误:安装软件包时遇到问题。


jq 如何获取特定孩子的所有父母

您好,我有以下 json 并尝试获取所有拥有“linux-image-amd64”的父母 { "web-prode-01.example.de": "错误:安装软件包时遇到问题。


Astro.js <Image>组件问题

我正在使用 Astro (v.4.0.8) 开发一个应用程序,我遇到了一个无法解决的问题。我想渲染图像并导入特定的 svg 以及来自 '... 的


无法在 Next JS 中显示来自 FastAPI 的 blob 图像

所以我有自己的使用 FastAPI 构建的 API,它返回一个图像 返回响应(内容= img_byte_arr.getvalue(),media_type =“image / jpeg”) FastAPI Swagger 中一切正常...


Flutter 中可以使用什么包来代替 open_file?

我在 Flutter 中有一个项目,我正在使用 open_file 包。我已将 Flutter 生成的 Android apk 上传到 AppSweep,它返回以下问题:Insecure file location is retr...


使用 CLI 导入 Apache Superset 问题

我正在使用 docker image 运行 apache superset 实例,UI 工作正常,我已成功创建数据源和仪表板,然后将其导出为 zip 文件。 我的问题是每当我尝试...


在操作中检测到不可序列化的值(redux-toolkit)

在store中action的payload中,我使用File类型存储下载的文件,然后该文件将在saga中通过验证 const form = new FormData(); if (私钥 &&


makefile 中的命令前面有反斜杠

在makefile中的命令前添加反斜杠有什么作用? 例如 本例中的 m 命令: # LaTeX Makefile 文件=报告 全部:$(FILE).pdf .PHONY:干净 干净的: m *.aux...


使用 expo go 从资产文件夹中读取文件

尝试使用 React Native expo go 从资产文件夹中读取文件 从“expo-asset”导入{资产}; 从“expo-file-system”导入*作为文件系统; ... const getFiles = asy...


GStreamer。如何更改v4l2src图像分辨率?

有管道: v4l2src !解码器!队列 !视频转换! xv图像接收器 启动 v4l2src 后,发现许多具有媒体类型 image/jpeg 和不同图像分辨率的大写字母。 v4l2src 选择第一个...


如何使用 ag 又名 the_silver_search 仅搜索目录?

我喜欢只搜索目录,选项 ag --list-file-types 对此没有帮助。坚持使用 ag 的原因是可以选择带有 --path-to-ignore 的文件,其中包含 pat...


使用 Notepad++ RUN 启动任何浏览器

shortcuts.xml 文件看起来正确。可能是文件位置?我将一个项目复制并粘贴到程序中。我应该导入它吗? 文件位置为 file:///C:/Users/user/Desktop/


使用 kubernetes python 客户端将文件从 pod 复制到主机

我需要使用 kubernetes python 客户端将文件从 pod 复制到主机。它类似于 kubectl cp pod:file file。 我正在测试以下代码:https://github.com/prafull01/Kuberne...


使用 MLKit 进行图像到位图转换返回 null

我在 Android 中,正在尝试将 Image 类型的对象转换为 Bitmap,以便将其附加到 Canvas 对象(Canvas 需要位图)。我转换为 InputImage,然后尝试从中获取位图。但是


如何在自定义 Angular 嵌套菜单组件上放置子菜单

我创建了一个 Stackblitz (https://stackblitz.com/edit/stackblitz-starters-xxbp1t?file=src%2Fmain.ts) 来演示我的多嵌套菜单的问题,但基本问题是当一个用户


致命错误C1034:stdio.h:未指定包含文件的搜索路径。 GraalVM Native Image 没有编译我的项目

GraalVM 没有编译我的项目,我尝试了以下方法: PS D:\Documents\Intellij Idea Projects\Project> ./gradlew.bat nativeRun 配置项目: 项目:=>“com.user.Project”Java 模块 任务:


使用makefile将.bin转换为.img

我正在写一个简单的引导加载程序, 我正在使用这个 make file 命令将 main.bin 转换为 main_floppy.img cp -f 构建/main.bin 构建/main_floppy.img 但我不断收到此错误 nasm src/...


如何缩放.png?

我正在制作一个网站,但我的徽标是 PNG 格式,因为它是像素艺术。我正在使用 CSS 行 image-rendering: Pixelated;在我的徽标图像上,但我还没有看到它在某些情况下是可靠的。 SVG


Stripe Card On File功能及流程

我正在使用 Stripe,想要实现“卡文件”功能。所以它会是这样的。 用户使用 Stripe Elements 在 UI 上输入信用卡 卡已保存,然后我们每次都会收取费用...


Azure 能否发布管道任务内联 Powershell 连接到 MongoDB load(file) 方法

一直在使用 MDBC powershell 模块连接到 Azure cosmosDB 中的 MongoDB 实例。需要加载带有代码的 .js 文件来更新集合。 示例:(mikesSuperHappyJS.js) var colle...


如何在 Spring boot 的全局异常处理程序中处理 MaxUploadSizeExceededException

我正在我的一项 REST 服务中上传多部分文件数据,并且我使用“spring.servlet.multipart.max-file-size=10MB”属性在 application.properties 中定义了文件大小限制。 ...


Tinylog 中的滚动文件会覆盖每次应用程序启动时的日志文件

我在Kotlin 2.6.2版本中使用tinylog。 这是我的tinylog.properties 文件: writer2 = 滚动文件 writer2.level = 信息 writer2.file = #{tinylog.directory}/log_{日期:yyyy-MM-dd}.{动态:


如何从与调用者相同的分支触发依赖工作流

假设我有一个这样的工作流程文件: 名称:部署映像 在: 工作流程_运行: 工作流程:[“构建图像”] 类型: - 完全的 因此,当 build-image 完成后,deploy-i...


如何使用 Isabelle 验证带有数组参数的 C 函数

我正在使用 Isabelle 来验证 C 程序。在验证过程中,我使用c-parser install-C-file加载代码,但是出现了以下问题: 尝试导致指针衰减


Laravel9 response()->stream() 使用 fwrite() 得到空结果

我需要将大量数据导出为 CSV 字符串。 所以我尝试将 fopen('php://stdout', w) 与 fwrite($file, $data) 一起使用。 但 Laravel response()->stream() 不会返回任何内容,也不会出现错误。 我...


如何使用Expo FileSystem.uploadAsync显示上传进度

我有一段代码如下,它利用 expo 文件系统将一个简单的文件上传为二进制文件,一切正常。 从“expo-file-system”导入*作为文件系统; const res = 等待 FileSy...


将三个 ts 线生成两个具有共享 x 轴的堆叠图

我有三个时间序列变量。其中两个包含在我的文件 roes.cvs 中,并使用以下代码绘制在一张图中: 鱼子 <- read.csv(file="roes.csv", header=TRUE, sep=",&q...


如何使用谷歌图表API在QR码中插入图像?

我正在使用谷歌图表API生成QR码,如何在Image中插入图像。 我现在得到的二维码是, 在此输入图像描述 我想要什么二维码, 在此输入图像描述 可以


react Native expo go 在 uvicorn https 后无法连接到本地主机

我正在编写一个带有 fastapi 后端的 React Native expo go 应用程序。 这是一个教育应用程序,所以它有图像、视频和 pdf 等。 React Native Image 组件未在 ios 模拟器上加载图像,我...


我正在使用从文件读取数据的数组创建一个选择

运行 getGrades() 方法时,它不断返回 B+。我不知道出了什么问题,我需要帮助。我将分享代码 尝试 { 扫描仪输入 = new Scanner(new FileInputStream(new File(&q...


当布局更改或数据更改时,如何确保我的 ReactJS Bumbeishvili D3-Org-Chart 正确更新?

我已经在 CodeSandbox 上复制并简化了我的问题,可以在此处查看:https://codesandbox.io/p/sandbox/d3-org-chart-react-function-org-chart-gvfz4l?file=%2Fsrc %2F组件%2F数据...


如何防止图片被下载到手机上?

假设这个标记: 假设这个标记: <picture> <source media="(max-width: 767px)" srcset="//placehold.it/350x150&text=Up+to+767" /> <source media="(max-width: 991px)" srcset="//placehold.it/350x150&text=Up+to+991" /> <img src="//placehold.it/570x200&text=Desktop+image" class="responsive-image" /> </picture> 是否可以在不使用 JavaScript 的情况下防止在小型设备上下载“最多 767”图像?虽然以下CSS将隐藏图像,并且似乎已经在视觉上解决了问题: @media (max-width: 767px) { .responsive-image { display: none; } } 它仍然会下载图像,这是我想避免的。我希望我可以简单地为我想要隐藏的图像提供一个空的 srcset 属性,但随后会加载下一个图像。 小提琴:https://jsfiddle.net/n68ousqu/ 我没有足够的声誉点来评论@MiscellaneousUser,但看来,至少在 Chrome 中,您可以从我原来的帖子中获取 HTML 和 CSS,然后只需将 loading="lazy" 添加到 img 元素即可获得这个工作。


© www.soinside.com 2019 - 2024. All rights reserved.