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 ?
Asked
Modified
9 years, 8 months ago
Viewed
423 times
Part
of PHP and Mobile Development Collectives
2 Answers
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
Saint - Cyr MAPOUKA
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
Victor Sanchez
On the link I provided, the answer explains how to put all the bytes from a File into a JSON object.
Saint - Cyr MAPOUKA
ok so if I get you well it means that everything is doing on the android application ?
Victor Sanchez
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?
Victor Sanchez
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.
|