upload

HttpUrlConnection multipart file upload with progressBar

爱⌒轻易说出口 提交于 2019-12-30 04:40:34
问题 I want to check progress of uploading file by HttpUrlConnection . How I can do this? I've tried to calculate bytes when writing data in OutputStream but it's wrong, cause real uploading happens only when I call conn.getInputStream() , so I need somehow to check inputStream. Here is my code: public static void uploadMovie(final HashMap<String, String> dataSource, final OnLoadFinishedListener finishedListener, final ProgressListener progressListener) { if (finishedListener != null) { new Thread

Rails 3: best way to preview image before upload

家住魔仙堡 提交于 2019-12-30 04:02:14
问题 I need to preview an image prior to submitting a form. I work with Rails 3 and needs something that is browser compatible. Any ideas how I can achieve that? 回答1: So! :) The main idea is to use the FileReader Javascript Class, which is really handy for what you need to do. You just have to listen to the "change" event on your file input and then call a method that will use the "readAsDataURL()" method of the FileReader class. Then you just have to fill the source of a "preview img tag" with

Unit Test a file upload, how?

試著忘記壹切 提交于 2019-12-30 04:00:15
问题 Using MVC3.NET I have a file upload method in a controller that works fine with the following signature public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> file) How can I unit test this with NUnit? I have looked around and everyone seems to point to Moq but I'm new to unit testing and cannot get Moq working. I have found interesting blogs such as this: http://danielglyde.blogspot.com/2011/07/tdd-with-aspnet-mvc-3-moq-and.html but am struggling to figure out how the same might be

Upload a File with Python

给你一囗甜甜゛ 提交于 2019-12-30 03:17:06
问题 I have an HTML form and I am using Python to generate a log file based on the input. I'd like to also be able to allow the user to upload an image if they choose. I can figure out how to manipulate it with Python once it's there, but I'm not sure how to get the image uploaded. This has most certainly been done before, but I'm having a hard time finding any examples. Can any of you point me in the right direction? Basically, I'm using cgi.FieldStorage and csv.writer to make the log. I want to

Upload images as BLOBs in Oracle using PHP

白昼怎懂夜的黑 提交于 2019-12-30 02:19:12
问题 Can anyone please tell me how to store images in an oracle database as BLOBs using PHP? A working example would be nice. Thankyou. 回答1: You first need to get the image that is being uploaded from the $_FILES #global array: $image = file_get_contents($_FILES['image_field_name']['tmp_name']); Then to insert the image in the database try this: $sql = "INSERT INTO table (id, image) VALUES(1, empty_blob()) RETURNING image INTO :image"; $result = oci_parse($connection, $sql); $blob = oci_new

RestKit Image Upload

*爱你&永不变心* 提交于 2019-12-29 11:42:08
问题 I am using RestKit to drive interactions with my web server. I am trying to use routing to POST an Event object to the server with an image attached to it. The code is as follows: RKObjectManager *manager = [RKObjectManager sharedManager]; RKObjectMapping *map = [self eventMapping]; manager.serializationMIMEType = RKMIMETypeFormURLEncoded; map.rootKeyPath = @"event"; [manager.mappingProvider setSerializationMapping:map forClass:[Event class]]; [manager.router routeClass:[Event class]

RestKit Image Upload

夙愿已清 提交于 2019-12-29 11:41:49
问题 I am using RestKit to drive interactions with my web server. I am trying to use routing to POST an Event object to the server with an image attached to it. The code is as follows: RKObjectManager *manager = [RKObjectManager sharedManager]; RKObjectMapping *map = [self eventMapping]; manager.serializationMIMEType = RKMIMETypeFormURLEncoded; map.rootKeyPath = @"event"; [manager.mappingProvider setSerializationMapping:map forClass:[Event class]]; [manager.router routeClass:[Event class]

facebook ios sdk - trouble posting photo using UIImage

允我心安 提交于 2019-12-29 11:40:09
问题 I'd be grateful for any suggestions as to how to deal with a problem I'm having posting an image to Facebook. The following code works just as I would expect: NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"http://myserver/img.png", @"picture", @"My Testing", @"name", @"Enter some text...", @"message", nil]; [appDelegate.facebook dialog:@"feed" andParams:params andDelegate:self]; However, I really want to use an image that I capture from my camera. I've set

Upload pdf file (from document directory) through web service in iPhone?

旧巷老猫 提交于 2019-12-29 08:22:09
问题 I'm working in iPhone application, upload pdf file from document directory through Web Service like "http://www.publigeee.com/index.php?q=api/upload&uid=1&title=Sample&file=Upload Pdf file here", How to do that? Please help me. Thanks in Advance 回答1: I've made this just some days ago. This code uses AFNetworking: https://github.com/AFNetworking/AFNetworking Code on the iPhone side (it uploads a pdf and another text parameter, item) NSData *itemData = [NSData dataWithContentsOfFile:filePath];

Upload pdf file (from document directory) through web service in iPhone?

南笙酒味 提交于 2019-12-29 08:22:03
问题 I'm working in iPhone application, upload pdf file from document directory through Web Service like "http://www.publigeee.com/index.php?q=api/upload&uid=1&title=Sample&file=Upload Pdf file here", How to do that? Please help me. Thanks in Advance 回答1: I've made this just some days ago. This code uses AFNetworking: https://github.com/AFNetworking/AFNetworking Code on the iPhone side (it uploads a pdf and another text parameter, item) NSData *itemData = [NSData dataWithContentsOfFile:filePath];