multipartform-data

Multipart/form-data and UTF-8 in a ASP Classic application

大憨熊 提交于 2019-12-06 02:13:55
问题 I have a problem that I really don't understand. I'm trying to upload a files in a asp classic app, without the use of an external component. I also want to post some text that will be stored in a DB. The file upload perfectly, I'm using this code: Upload Files Without COM v3 by Lewis E. Moten III The problem is the other form input fields. I'm using UTF-8, but they don't end up as UTF-8. I.e Swedish characters å ä and ö is displayed as question marks if I print them out using Response.Write.

javax.mail.internet.ParseException: In Content-Type string , expected '/', got :

拜拜、爱过 提交于 2019-12-06 01:55:23
I want to implement mail with attached file using JSF. I tried this code: private Part file; private String sendFromGMail(String from, String pass, String[] to, String subject, String body) { String status; Properties props = System.getProperties(); String host = "smtp.gmail.com"; props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", host); props.put("mail.smtp.user", from); props.put("mail.smtp.password", pass); props.put("mail.smtp.port", "587"); props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props); MimeMessage message = new

Upload image with multipart form-data only in Swift 4.2

被刻印的时光 ゝ 提交于 2019-12-06 01:54:10
问题 I tried lots of solution. I get some but they were using objective c code in somewhere. I need solution only in swift 4.2 and without any third party (like Alamofire ).It is working fine using objective c classes . I have been able to make POST request with only, headers and other parameters and image as: Upload files using multipart request - Swift 4 How to do multipart/form-data post request with Swift? Multipart-form (image,parameters,headers) Post request with Alamofire in swift Upload

Sending more than one image with AFNetworking

北城余情 提交于 2019-12-06 01:21:12
问题 I'm developing a messaging app, and users can also send pictures to one another. When a user sends more than one picture I send them in parallel (I don't wait for the first one to finish upload before I send the second one) Before moving to AFNetworking I succeeded in doing this with ASIFormDataRequest , and indeed if I sent 2 images, both of them were transmitted in parallel and successfully delivered to the other user. When I try doing this with AFNetworking, I get some strange behavior. I

Retrofit 2.0 multipart

跟風遠走 提交于 2019-12-05 20:27:17
I have working OkHttp MultiPart request : multi = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("email", m) .addFormDataPart("password", p) .addFormDataPart("user_name", n) .addFormDataPart("user_phone", phone) .addFormDataPart("photo", "avatar.jpg", RequestBody.create(MediaType.parse("image/jpg"), imgToArray(bmpChosenPic))) //.addFormDataPart("photo", "1") .build(); request = new Request.Builder() .url(Utils.TEST_BASE_URL + "" + REG_URL) .post(multi) .build(); client.newCall(request).enqueue(new Callback()... Now I try to make the same function using Retrofit 2.0 .

Spring Multipart File with @RequestBody

不羁岁月 提交于 2019-12-05 20:01:52
I am trying to upload data from an app to a spring backend service. Things to upload are a DataModel containing data of the object to create and several images linked to the data. Therefore I am using this method signature: @RequestMapping(method = RequestMethod.POST) @ResponseBody public Survey createSurvey(@RequestBody SurveyPostHelper helper, @RequestParam(value="file", required = true) MultipartFile[] images) I tried to play with the annotations, but either I get a blank images array or my helper is empty. How would you solve this? Thanks in advance. I found out, that this method signature

Alamofire upload huge file

安稳与你 提交于 2019-12-05 17:49:56
I am using Alamofire to upload assets (image/video) as multipart form data. It works fine for file sizes below 300MB (app). When I try to upload a file greater than 300MB, app crashes. if let video = self.avPlayerItem?.asset as? AVURLAsset { if let assetData = NSData(contentsOfURL: video.URL) { multipartFormData.appendBodyPart(data: assetData, name: "file", fileName: "video", mimeType: "video/mp4") // Execution stops here } } I also get the below message from Xcode How would I support uploading huge sized videos using Alamofire? Use Stream to upload instead of converting file to NSData which

uploading a file to imgur via python

我只是一个虾纸丫 提交于 2019-12-05 17:40:09
I'm having trouble uploading an image to Imgur using the python requests module and the Imgur API. My code is the following: import base64 import json import requests from base64 import b64encode client_id = 'my-client-id' headers = {"Authorization": "Client-ID my-client-id"} api_key = 'my-api-key' url = "http://api.imgur.com/3/upload.json" j1 = requests.post( url, headers = headers, data = { 'key': api_key, 'image': b64encode(open('1.jpg', 'rb').read()), 'type': 'base64', 'name': '1.jpg', 'title': 'Picture no. 1' } ) I usually get a 400 response error. I'm not sure if myu client_id is wrong,

Mixed POST submit from AngularJS to Spring RestController

假如想象 提交于 2019-12-05 17:18:42
Basically I want to be able to post a form with some fields (JSON) and an attachment (multipart). Following is actually working code, the problem is that I don't like it so it mainly functions because of workarounds. Angular controller $http({ method: 'POST', url: 'rest/store/logo', headers: {'Content-Type': undefined }, transformRequest: function (data) { var formData = new FormData(); //need to convert our json object to a string version of json otherwise the browser will do a 'toString()' on the object which will result in the value '[Object object]' on the server. formData.append("store",

Jaxrs multipart

戏子无情 提交于 2019-12-05 17:15:45
问题 I'm trying to perform a request to a jaxrs service which has media type set to multipart/form-data . This request contains a list of entities(xml) and an image(png, binary). I have created the request as described in this thread by BalusC. The request seems ok after inspecting it in wireshark, except for the ip header checksum being wrong.(says something about "may be caused by IP checksum offload".) My big issue here is how to handle the multipart request on the service side. I do not wish