0

I'm using Symfony2 to build a web application and provide an API in JSON form to an Android application. Every thing is fine but now we (the Android developer and me) want our system to manage file upload like the user use the android application (from his mobile phone) to upload a file on the server side where Symfony2 is working and we don't know whether the upload sript should be done on client side (within the android application) or on the server side (within the symfony2 code). For now I think that all should be done on client side: all I've to do is to give to the android developer the URL where the file should be deposited and an API with JSON in order to recieve only the name of the file (in string format)... am I not right ?

2 Answers 2

1

The other solution is transforming the file into a base64 then send it through json, the server side having to save it either on disk or in database. To get the file, you can also transform it into a base64 and send back to the android app to reconsituate the original file.

Sign up to request clarification or add additional context in comments.

Comments

0

Please take a look at this question How can I add an image file into json object?

When handling the JSON, you can store the file in your DB as BLOB or do something else in your Symfony application.

9 Comments

all my problem is about how to move this file physically from the mobile app to a specific location on the server but I don't use the BLOB method. Now the scrip that should move the file ... where is it suppose to be located on android or server side
On the link I provided, the answer explains how to put all the bytes from a File into a JSON object.
ok so if I get you well it means that everything is doing on the android application ?
Well, that's one way to handle it if you already got the File in your android app and want to use JSON. See also How to send a file in Android from mobile to server using http?
Another way would be to send only the file via socket Transfer file from android to pc using socket programming. Sending it via sockets would require more work and using something like Gos Web Socket Bundle to handle the socket.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.