ok so i need to upload files directly to server without using any web service from android ..
first i am doing so with REST web service but the thing is it always say transaction is too large when executing my request .... in android i convert the image into byte[] then into Base64 string from my server side i decode this Base64 string and write bytes into file.
how can i upload directly to folder on my server ... something like executing a function that upload the file to "localhost/myWebApplicationDir/images/"then file here.jpg"
You will need to implement something that handles uploads as webservers typically don't do that out of the box. I'm sure you can find a POST upload script written in PHP somewhere on google. Then implement some code that POSTs the file to the endpoint and you should be fine.
There are no out-of-the-box tools for this but it's not a lot of work.
i found this link to be very helpful i discovered that you need an open connection with the server and communicate with streams something like keeping connection alive and upload files bit by bit.... but still you need a web service like #meredrica said.
http://ihofmann.wordpress.com/2013/01/23/android-sending-post-requests-with-parameters/
Related
Currently working on an API which make the client (Android/Kotlin) being able to download a video from the server. With a traditional HTTP URI it would be a pretty easy task, I would just DownloadManager and the problem is solved. However, I'm using gRPC (c++) for the server.
I currently have a solution with Kotlin flows which basically take the unidirectional stream from the server and consume the file chunk to store them in local file. However, even if it works for the major parts, It has a lot of corner cases and that is why I want to use DownloadManager. For further information on what I have currently please check: Handling file download with gRPC on Android
After looking for a solution for a little while now, I found that it is possible to map the RPC call to REST API by using this project and basically do something like:
rpc Download(DownloadRequest) returns (DownloadResponse) {
option (google.api.http) = {
post: "/v1/download"
body: "*"
};
}
or use a YAML file to configure the google API.
All of this seems to be pretty convenient while using Google Cloud and Golang but I'm creating a standalone server in C++.
So there are two questions here:
Is it possible to serve static file in a REST way with gRPC c++
Is there another way to use DownloadManager with gRPC ?
As the commenter on the question suggested, gRPC is for structured data not raw file downloads. Trying to map between a URI and the RPC call would not be enough to make DownloadManager work with gRPC, because the gRPC server is going to send and expect additional data beyond the raw file itself that will not be understood or sent by DownloadManager.
You can certainly use gRPC server and client to send large files, but it's not going to have the same set of features built-in for large file downloading (such as resuming your download later if the connection is broken) as using something like a HTTP server + a specific file download library/client. I would recommend just running a separate HTTP server for your file download needs.
[crossposting my answer from the grpcio mailing list]
I have an asp web page which needs to grab an xls file from the device storage area on my android tablet, convert it into bytes and store it in my SQL database.
I can do the converting and storing bit but I have no idea as to how to get the file using VB.
Can anyone tell me how I can get the file without the user having to search for it using an upload control?
I would also like to delete the file after processing..
Thank you..
Derek.
In order to think about this we need to have clear in our minds where the division between client and server exists: You've got a webserver running ASP and a client running a webbrowser on the android platform.
The file you are trying to upload exists on the client. As such any code which does the uploading will have to run on the client and, as the client is running on android, it's unlikely it'll be VB doing the uploading. You're likely to need to use a scripting language like Javascript and, if you care about cross-browser support, be careful how you do it.
The server cannot get the file directly from the client due to common security restrictions.
Once the client side script has got the file, it'd usually send the data to the server using a webservice or other endpoint, deletion of the file can then happen after that.
I need to download a set of files from server via ftp. For example say ftp://ftp.example.co.uk/folder1/textfile1
I cant seem to find much information about using ftp and android. Can in be done in the same way as an http network request http://developer.android.com/training/basics/network-ops/connecting.html
If not, can someone point me to a tutorial on how to do so.
Have you considered formatting your file to base64 and creating a web service to handle the request?
I have some questions about developing a Android application which shall be able to communicate with a NodeJS server.
The Android application gathers some data and saves everything in a .csv file.
This file now needs to be uploaded to a NodeJS server. The NodeJS server should save the file as well as storing the content in a MongoDB.
My question now is how I should implement the communication between the Android device and the server.
I know how to upload a single file to a NodeJS server using a HttpURLConnection with a DataOutputStream.
But I need more than just uploading the file because I need a unique identification of each Android device.
I thought about using the (encrypted) Google account E-Mail address of the user to distinguish the devices. I am not interested in knowing who uploads which data but I need to store the data for each device separately.
The problem is that I don't know how to communicate between the device and the server.
If I upload a file via HttpURLConnection and DataOutptStream it seems that I can only upload the file without any additional information like the unique key for the device.
I also thought about uploading the file via sockets. But I am not sure how to handle huge file sizes (5 MB or more).
I am not looking for code fragments. I rather need some hints to the right direction. Hopefully my problem was stated clearly and someone can help me with this.
Using a HttpUrlConnection on the Android side, and a RESTful server on the Node side would be a straightforward option.
You can embed information into the URL in a RESTful way:
pathParam: www.address.com/api/save/{clientId}/data
queryParam: www.address.com/api/save/data?c={clientID}
each uniquely identifying the client. This can be whatever scheme you choose. You will have to build the HttpUrlConnection each time as the URI is unique, and important!
The server side can then route the URL however you see fit. Node has a number of packages to aid in that (Express, Restify, etc.). Basically you'll grab the body of the request to store into your DB, but the other parameters are available too so it's all a unique and separated transaction.
Edit: The package you use for RESTful handling can stream large files for you as well. Processing of the request can really begin once the data is fully uploaded to the server.
Using a socket would be nearly just as easy. The most difficult part will be 'making your own protocol' which in reality could be very simple.
Upload 1 file at at time by sending data to the socket like this:
54::{filename:'myfilename.txt',length:13023,hash:'ss23vd'}xxxxxxxxxxx...
54= length of the JSON txt
:: = the delimiter between the length and the JSON
{JSON} = additional data you need
xxx... = 13023 bytes of data
Then once all the data is sent you can disconnect... OR if you need to send another file, you know where the next set of data should be.
And since node.js is javascript you already have wonderful JSON support to parse the JSON for you.
Would I suggest using a socket? Probably not. Because if you ever have to upload additional files at the same time, HTTP and node.js HTTP modules might do a better job. But if you can guarantee nothing will ever change, then sure, why not... But that's a bad attitude to have towards development.
After countless headaches and time wasted I managed to get the AudioRecorder working for Android and have a file stored on my SDcard. What I want to do now is send this file to a server within the application. So when the user hits submit...it sends the .3gp file. Is this possible? Thanks
I'd recommend that you just use HTTP and POST it to your server.
Here's a good little code snippet that shows how to do an HTTP post from java.
http://rapidandroid.org/wiki/HttpUpload
Then you'll have to receive the file on your server. You could just use a simple php script for that unless you have some other server side technology.
Here's some documentation for doing this using php:
http://www.tizag.com/phpT/fileupload.php
yes you should use FTP because it will be faster...
I had done bit R&D on it and found few link but most of them were not working.
here is the link that is working for FTP upload..
http://www.jibble.org/simpleftp/