multipartform-data

Glassfish - uploading images - doing it right

大城市里の小女人 提交于 2019-12-04 10:10:24
I am on latest glassfish (3.1.2) - so no need for apache FileItem and no bugs with getPart(). I read that the best practice on uploading images is saving them on the file system (see here for instance). I am editing already existing code - smelly at that - so I had the idea to do : Part p1 = request.getPart("file"); System.out.println("!!!!!P1 : " + p1); Prints : !!!!!P1 : File name=DSC03660.JPG, StoreLocation=C:\_\glassfish3\glassfish\domains\domain1\generated\jsp\elkethe\upload_7cb06306_138b413999a__7ffa_00000000.tmp, size=2589152bytes, isFormField=false, FieldName=file newlines mine. In the

Spring REST - Can a RestTemplate consume multipart/mixed?

半城伤御伤魂 提交于 2019-12-04 09:50:22
I want to write a REST service which does responed with a zipFile and some json data, everything in one multipart/mixed request. The server part works fine and i am testing it with the REST Client from firefox. My Server sends a multipart like this --k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH Content-Disposition: form-data; name="form" Content-type: application/json {"projectName":"test","signal":"true"} --k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH Content-Disposition: form-data; name="file2"; filename="file2.txt" Content-type: application/octet-stream Content-Length: 10 hallo=Welt I know that

How to submit multipart formdata using jquery

你说的曾经没有我的故事 提交于 2019-12-04 09:42:20
问题 <form id="uploadForm" enctype="multipart/form-data" action="http://localhost:1337/ad/upload" method="post" name="uploadForm" novalidate> <input type="file" name="userPhoto" id="userPhoto" /> <input type="submit" value="submit" id="uploadImage" /> </form> This is my html form which accepts an image as file inout, the user can select an image file and then click submit. This works but the url of the current page changes to localhost:1337/ad/upload. I want the page to stay at the same url. $(

How to send an object in multipart formData using request in node.js

前提是你 提交于 2019-12-04 07:26:00
I'm trying to formulate a POST using request , but I keep getting an error anytime I try and add the to object to formData . var fs = require('fs'); var request = require('request'); var file = './test/assets/test.pdf'; var opts = { url: 'my_service', method: 'POST', auth: { user: 'username', password: 'password' }, json: true, formData: { front: fs.createReadStream(file), to: { name: 'joe bob', address_1: '123 main st', ... } } }; request(opts, function(err, resp, body) { console.log(err, body); }); Here is the error: /sandbox/project/node_modules/request/node_modules/combined-stream/node

Sending more than one image with AFNetworking

China☆狼群 提交于 2019-12-04 05:54:55
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'll try to describe the case were user1 send two images too user2: User1 send image1 -> everything looks

Waiting for multipart image sending get completed

僤鯓⒐⒋嵵緔 提交于 2019-12-04 05:22:25
问题 I'm impementing an application in iOS7, it's kind of a social network app with posts with images and a backend that saves all of the data sent form the client. The iOS client is sending the information of the post via json and after the info is sent, it starts to send the image via multipart form using AFNetworking . I need to be notified when the image is sent, so that I can refresh the main view of the app with the new posts, including the recently posted by the client. In the practice if I

File Upload with Additonal Form Data to Web Api from MVC

回眸只為那壹抹淺笑 提交于 2019-12-04 04:36:23
I am trying to upload a file with additional form data and post to Web API via MVC but i couldn't accomplish. MVC Side Firstly i got the submitted form at MVC. Here is the action for this. [HttpPost] public async Task<ActionResult> Edit(BrandInfo entity) { try { byte[] logoData = null; if(Request.Files.Count > 0) { HttpPostedFileBase logo = Request.Files[0]; logoData = new byte[logo.ContentLength]; logo.InputStream.Read(logoData, 0, logo.ContentLength); entity.Logo = logo.FileName; entity = await _repo.Update(entity.BrandID, entity, logoData); } else entity = await _repo.Update(entity,entity

Nginx proxy_cache_key $request_body is ignored for large request body

两盒软妹~` 提交于 2019-12-04 04:28:17
I use nginx as a reverse proxy and I would like it to cache POST requests. My back-end is correctly configured to return appropriate cache-control headers for POST requests. In nginx I have configured: proxy_cache_methods POST; proxy_cache_key "$request_method$request_uri$request_body"; This works great for small HTTP POST requests. However I started noticing that for large requests (e.g. file uploads) it seems like the $request_body is ignored in the proxy_cache_key . When a form containing a file upload is submitted twice with completely different data, nginx will return the cached result.

Unable to process parts as no multi-part configuration has been provided

 ̄綄美尐妖づ 提交于 2019-12-04 03:09:48
问题 I wrote a simple controller for uploading files: @RestEndpoint public class ImageController { @Autowired GridFsTemplate mTemplate; @RequestMapping(value = "images", method = RequestMethod.POST) public @ResponseBody String testPhoto(@RequestParam String name, @RequestParam String directory, @RequestParam MultipartFile file) throws IOException { if(!file.isEmpty()){ final byte[] bytes = file.getBytes(); InputStream inputStream = new ByteArrayInputStream(bytes); mTemplate.store(inputStream,

How to do multipart/form-data post request with Swift?

江枫思渺然 提交于 2019-12-04 01:59:52
问题 let Url = String(format: "http://url/ios.php") guard let serviceUrl = URL(string: Url) else { return } let parameterDictionary :[String:String] = ["Episodes" : "http://url/anime/07-ghost.html"] var request = URLRequest(url: serviceUrl) request.httpMethod = "POST" request.setValue("multipart/form-data", forHTTPHeaderField: "Content-Type") request.httpBody = NSKeyedArchiver.archivedData(withRootObject: parameterDictionary) let session = URLSession.shared session.dataTask(with: request) { (data,