问题标签 [multipartentity]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
687 浏览

android - android中的多部分请求问题 - 抛出错误的请求

每当我尝试执行此代码时,我都会从服务器收到“400:BAD REQUEST”。无法在这里找出问题,有人可以帮助我纠正这个问题吗?

0 投票
0 回答
2253 浏览

android - 在android中base64编码期间内存不足异常?

我必须使用多部分实体将四个图像从 android 上传到服务器。我通过使用 base64 解码来发送图像。它显示内存不足异常。我在下面发布了代码。请帮我修复错误。

我在异步任务中调用此函数。

图像尺寸大时出现内存不足异常?

0 投票
2 回答
20579 浏览

android - How to open a file in raw folder in Android

I am usin MultipartEntity and I am trying to refer to the file in the raw folder. Here is the code:

The test.txt file is in my res/raw folder. When I execute the code I get the following exception : FileNotFoundException: /test.txt: open failed: ENOENT (No such file or directory)

Can anyone help me with this?

0 投票
1 回答
373 浏览

delphi - Indy [Delphi] 中的 MultiPartEntity

我正在尝试将附件添加到一项服务。这取自文档: 在此处输入图像描述

我想知道是否可以在 indy 中添加一个实体,就好像它可以在例如 Java 中完成一样:

0 投票
0 回答
76 浏览

android - Android 应用程序中的 file.exists 不一致

我正在为 API 2.3 及更高版本开发一个 Android 应用程序。我正在使用 Android 相机拍照并将图像放在指定的文件中。这可行,一旦返回,我使用 file.exists 命令检查它是否有效,然后将其显示在图像视图中。

我稍后将图像路径传递到存储在数据库中的对象中。我后来回忆了这个对象,将路径作为字符串获取,创建一个文件对象并将这个字符串传递给它。这样做之后,我调用返回 true 的 file.exits()。

但是,稍后在另一个线程(实际上是一个意图服务)上,我尝试使用 org.apache.http.MultipartEntity 和基于相关库的方法将图片上传到服务器。

在将包含图像路径的文件传递给 multipartEntity 之前,我检查文件是否存在。然而这一次它返回假。

为什么会这样做?为什么会有不一致的地方。我忽略了一些安全权限/功能吗?

0 投票
1 回答
1373 浏览

java - Android - 如何在外部网站的 HTML 表单中填写数据并点击上传按钮?

我有一个安卓设备。我想在我的应用程序中填写一个带有编辑文本等的表单(其中一个字段将采用 SDCard 上图像的路径)。我希望这些表单内容成为需要上传此文件(来自 SD 卡)的外部网站中 HTML 表单的数据。HTML 表单有一个上传按钮。我不想向我的 android 应用程序用户展示这个 HTML 网页。有没有办法做到这一点?请告诉我!谢谢!

编辑:我浏览了很多网站,我知道我应该使用 HttpPost。不过我有一些疑问: 1. 您在 HttpPost 中使用的 url 是什么 - 它是包含表单的 url,还是表单重定向到的 url。2.在多方中,addPart的第一个参数是什么?是赋予字段的 ID 还是名称?3. HttpPost 怎么知道它应该去哪个表单?

0 投票
2 回答
6588 浏览

java - Android HttpClient 发布文件 MultipartEntity

我正在尝试使用 HttpClient 和 MultipartEntity 将图像从 Adroid 应用程序上传到 php 网络服务器。

这是我的代码片段:

在 php 文件中,我添加了 print_r($_FILE) 来查看数组的内容,它显示的是一个空数组。

执行 HttpClient 后 LogCat 显示以下内容

谁能告诉我我必须添加到 Android 代码中吗?

0 投票
2 回答
10571 浏览

android - Android/Java:尽管将 MultipartEntity 类添加到构建路径中,但找不到它

我正在编写一个应用程序,让用户可以选择手机上已有的照片并将其上传到服务器。不幸的是,当我单击按钮将照片发送到服务器时,在 logcat 中我看到:

我已经看到堆栈溢出中存在的所有类似问题:

还有一些,但关键是,它们都没有一个好的答案。解决方案包括:

  • “从http://hc.apache.org/downloads.cgi下载所有必要的 jar ,并将它们添加到 Eclipse 中的 Java 构建路径。” ** 不起作用。我已经尝试过了,清理了项目,关闭/打开了 Eclipse。没有什么。

  • “将所有 jars 添加到项目中的 libs 文件夹中,其余的由 Android 完成。” **仍然,它不起作用。我不知道为什么。

出于某种原因,即使它将此错误发布到 logcat,它仍会继续运行,并且稍后当我尝试使用我在代码中创建的 MultiPartEntity 对象时才会崩溃。这是 logcat 的其余部分:

还有更多,但你明白了。下面是相关代码。ImageUploadTask 是一个内部类:

谢谢。

0 投票
0 回答
922 浏览

android - get and send data to server is slow on wifi, fast on mobile internet.

I have an async task which fetches a file from my server. it takes long before it starts but when it starts it is fast. on mobile its is done in about 5 seconds while on wifi i can wait for 40seconds+.

this is the asynctask: public class ProgressTask extends AsyncTask { @Override

so it starts savewidget. savewidget = download file and store it local

here is the savewidget:

anyone who can explain why it needs so much time just to fetch a small over wifi and it goes fast over mobile internet? i'm kinda clueless atm.

is this a good way or is there a better?

maybe not bad to mention, at some point i use multipartentity in a service to send a video and data to the server. it works but just like this it is slow. once the first video is uploaded it goes fast.

multipartentity to send video:

thanks in advance

0 投票
1 回答
2883 浏览

android - android中的NoClassFoundError MultipartEntity错误

我无法解决这个问题。我添加了以下罐子。

Add External JARs我通过选项添加了这些 jar Build Paths,然后将它们手动添加到libs我的 eclipse 项目的文件夹中,但在调试以下行时它仍然给我以下错误。

实际上,我正在尝试使用它将多个图像上传到我的 php 服务器。

日志猫: