Android FTP from URL - android

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?

Related

how to use Apache at my Android App

I want to read and update data from server (using Apache) to my Android App.
I`m new at the Apache part.can anyone give me a guide for this kind of operation? I already download "XAMPP", and my main goal is to read a JSON into my App, but I believe I can manage also with php .
I know that this is general question but I don't understand at this subject.
Thanks.
the most basic way is to make sure your web server is listening on an open port(usually 80). in your android app send a request to your webserver (url request). on your server hava a script that echos or prints JSON data...
Apache is a web server. You need to connect to it using HTTP. There is an HttpClient and other ways to get http server data, as long as you have a network connection.

uploading files directly to server without web service from android

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/

How to get the url of the website to which I upload a file?

Hi and thanks for any suggestion,
I have done my homework and tried to find an answer on SO and around, but so far I have been unable to find a solution.
I am trying to build some kind of FileManager to allow user to upload files on websites (any website, for example add an attachment to a mail in yahoo mail...)
Therefore my application registers a filter so that when the browser requests a file to upload the app opens up and provide the file to the requester (the web browser).
My question is:
is there a way for me to retrieve the url of the website to which the file is uploaded ?
I'm not sure I understood your question currently. my answer is relevant with the assumption: you want to have a direct download url to the file that been uploaded, and you wish to use this url in some point in the future to download that file...
I am afraid there is really no way getting such information.
there are many obstacles in the way of getting url to the file that been uploaded:
there is no any system broadcast / event that been sent in this scansion
even if the upload process was managed and initiated from you own application with you own WebView - the website you uploading to not necessarily provide you information of what is the url of the uploaded file. I know for sure that companies like yahoo not provide you this url.
if that's not enough - there is no necessarily such url at all!
the fact is that the server you uploading to is not necasserly doing anything with the uploaded file, or just not exposing him to public access with url.
from the reasons I mentioned, developing app as you which can be done only with servers providing their own API for upload files, and returns you the url as respond.
of-course each server has it own API (if at all) and you should speak with each one of the servers you'd like to support with it own language. sort of mission impossible if you want to support most of the big sites...
I had similar problem as to how can I get the URL where my file is uploaded. The answer is simple and lies in your Android code.
For uploading a file to some place, you need to know URL of the server/website.
So lets say you are uploading a file to
www.yoursite.com/appdatafolder/
For uploading to the file to the given address, you have to have a php script file sitting there, which will communicate with your android code for uploading the data.
Lets consider the address is:
www.yoursite.com/appdatafolder/upload.php
Now it depends on your code on how did you wrote your php script, in my case, I also send the name of the file to upload.php file, you can ignore it if you want or your script follows some other algo.
Lets say you want to upload importantfile.txt, so the url for uploading the file becomes
www.yoursite.com/appdatafolder/upload.php?filename="importantfile.txt"
The address you need to provide to the user in order to download the file becomes:
www.yoursite.com/appdatafolder/importantfile.txt
Now what you can do is save this address in a local database on your phone and use it whenever the user wants to download the file.
If you are afraid of securing the files which can be accessed/downloaded
www.yoursite.com/appdatafolder/
you can use htaccess. There are alot of other security mechanisms out there for securing data on the server from hacking. htaccess is simplest example.
So this is the easiest and hassel free way of solving your problem.
If you want, I can provide the php script I used.
Hope this helps.
If their is no secure layer on the web site, data sniffing by the app could be a kind of solution. you'll also probably need to deal with content encoding like gzip.
You'll need to filter the result's. It is easy to do: You just need to look at the application level in the OSI model.
Then you can apply a second filter if you know the ip address or the hostname of the concerned site.
There is even one more filter if you know the request method. But most it is get or post most of the time.
Have you looked at this question: Android file chooser? It has great example code as well as a link to a GitHub project (aFileChooser).

Multiple HTTP Connections (Segmented/Swarm Downloading) to download the same file in Android

I'm currently working on creating a Download Manager for Android. In order to optimize the download I need to download the same file using multiple connections to the server. (ie. the same technique used in Internet Download Manager used in Windows.)
The thing is I don't know how to create several HTTP connections and download the same file. I hope you can help me.. Thanks in advance!
Spawn off a few threads which request part of the file via the Header Content-Range keyword. see Reading the first part of a file using HTTP

How to upload a 3gp file on SDcard to a server?

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/

Categories

Resources