upload

ByteArrayOutputStream to a FileBody

假装没事ソ 提交于 2019-12-04 21:06:47
问题 I have a Uri to an image that was either taken or selected from the Gallery that I want to load up and compress as a JPEG with 75% quality. I believe I have achieved that with the following code: ByteArrayOutputStream bos = new ByteArrayOutputStream(); Bitmap bm = BitmapFactory.decodeFile(imageUri.getPath()); bm.compress(CompressFormat.JPEG, 60, bos); Not that I have tucked it into a ByteArrayOutputStream called bos I need to then add it to a MultipartEntity in order to HTTP POST it to a

Uploading a Base64 encoded Image to PHP server

亡梦爱人 提交于 2019-12-04 20:52:52
I'm trying to upload a Base64 encoded .Png file to a PHP server from an Android application. Below code doesn't return anything in the response. What am I doing wrong? I'm sending the Base64 encoded string and the name of the file. (ex:"sign1234.png") <?php if(isset($_POST['image']) && isset($_POST['name']){ $image = $_POST['image']; $name = $_POST['name']; $png = base64_to_jpeg($image,$name); $target = 'uploads/'.$name; $result = move_uploaded_file( $_FILES['$png']['tmp_name'], $target); if($result){ $response["success"] = 1; $response["message"] = "Upload Successful."; echo json_encode(

kohana 3 uploading image without using any modules?

风格不统一 提交于 2019-12-04 20:38:53
does anybody have an example of uploading images in kohana 3 without using any modules eventually ? i used https://github.com/kohana/image/tree/3.1%2Fmaster but my error is: Fatal error: Uncaught Kohana_Exception [ 0 ]: Installed GD does not support images is there any easy and fast way to upload files in a kohana 3 based website? thanks! Kohana API should help. Basic steps are: Create Validation object ( $array = Validation::factory($_FILES); ) Define rules ( $array->rule('file', 'Upload::not_empty')->rule('file', 'Upload::type', array(array('jpg', 'png', 'gif'))); ) Check file(s) ( if (

android efficient way to upload image to server

折月煮酒 提交于 2019-12-04 20:37:50
I'm looking for a way to upload an image from android to php server, currently I'm encoding the image to base64 and send it, but it's too slow, is there is a better way I'm using volley as network client. My 2 cents: Few things can be improved depending on what you are targeting. If you are worried about the data usage , then you can decrease the size of the image before uploading. Now a days for the newer phone models, the picture resolutions are very high. You can alter the size of the image on the device itself before uploading. Eg: How to resize image (Bitmap) to a given size? and Decrease

How to post large video on a server, in Android?

眉间皱痕 提交于 2019-12-04 20:17:26
问题 I am trying to post a large video (nearly 1 GB). I am using FTP to send video to a server, but the upload stops after a while. On the server the video crashes, but I am able to upload a smaller sized video. I've also used HTTP to send video to the server, sent as a Base64 enoded string, but there is an out of memory exception while encoding. I've tried to upload the video as a file, but without success. What is the best way to upload a large video to a server? 回答1: Use HTTP POST, and post

How to send a image to a php file using Swift

萝らか妹 提交于 2019-12-04 20:09:51
For my app i need to send a image to a php file. I already know how to send strings using this: var bodyData = "info=test" let URL: NSURL = NSURL(string: "LINK TO A PHP FILE") let request:NSMutableURLRequest = NSMutableURLRequest(URL:URL) request.HTTPMethod = "POST" request.HTTPBody = bodyData.dataUsingEncoding(NSUTF8StringEncoding); NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response, data, error) in println(NSString(data: data, encoding: NSUTF8StringEncoding)) } And in my php file: $info = $_POST['info']; echo $info; But i don't know how to send

upload video using Retrofit 2

家住魔仙堡 提交于 2019-12-04 19:44:23
I want to upload a video file using Retrofit 2 , please help me doing this. This is my endpoint: upload.php : <?php $uploaddir = '../uploads/'; $uploadfile = $_FILES['userfile']['name']; $response = array(); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir.$uploadfile)) { $response["result"] = "1"; echo json_encode($response); } else { $response["result"] = "-1"; echo json_encode($response); } ?> I tried to follow a sample (combining it with file selection from the gallery) on the web, but it doesn't even compile (I have marked the erroneous line by a comment): MainActivity :

Asihttprequest upload file

风格不统一 提交于 2019-12-04 19:34:56
imusing Asihttprequest to upload file to a server, i have 2 questions : the progressView is not moving smoothly, in fact it move to the and when upload is finish. when i try to upload a big image (> 2 mo approximately ) the upload fail . hers is my code : ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http:xxxxx" ]]; [request setDownloadProgressDelegate:progresse]; [request setPostValue:@"upload" forKey:@"action"]; [request addData:[NSData dataWithData:UIImageJPEGRepresentation([UIImage imageNamed:@"xxxxx.jpg"],0.9)] withFileName:@"img.jpg"

Unsafe JavaScript attempt to access frame, when try to upload file with ajax

痞子三分冷 提交于 2019-12-04 19:32:20
My goal is to upload file with ajax-way. I use this javascript library http://valums.com/wp-content/uploads/ajax-upload/demo-jquery.htm There is a link on my page like "Upload" button on example page. When I click it, "Open file" dialog is open. I choose file and form is automatically submitted. This is my javascript code. var upload_btn = $('#upload-opml'); new AjaxUpload(upload_btn.attr('id'), { action: upload_btn.attr('href'), name: 'opml', onComplete: function (file, response) { // } }); This is server code in Ruby on Rails. def upload_opml render :text => 'hello' end Headers, taken from

Angular JS + Laravel 4: How to compile for production mode?

一笑奈何 提交于 2019-12-04 19:31:12
So i have watched the 5 part youtube videos by David Mosher about Angular JS (vids great by the way). In the part 2 ( http://www.youtube.com/watch?v=hqAyiqUs93c ), it has a practical mysql database usage which I almost wanted. I'm going to use AngularJS along with Laravel 4, but I had no idea which files I'm going to upload for the web hosting later . I'm trying to run the web app under "/public" folder in my root on localhost (localhost/public/) but the css and js points to the wrong directory (points to the root: '/css/style.css'). Another method I have tried is by copying all the files to