How do I set the publisher field of an image upload to the currently logged in user?
Anybody?
Hi Evan,
The field is populated automatically when a logged in user in your app performs a file upload using the API.
Regards,
Mark
I did that and the publisher is blank.
What API do you use to upload a file?
Backendless.Files.Android.upload(bitmap, Bitmap.CompressFormat.JPEG, 100, pictureName, "img", new AsyncCallback<BackendlessFile>() {
@Override
public void handleResponse(BackendlessFile response) {
pDialog.cancel();
finish();
}
@Override
public void handleFault(BackendlessFault fault) {
pDialog.cancel();
Toast.makeText(PostActivity.this, fault.toString(), Toast.LENGTH_SHORT).show();
}
});
Thanks. I am curious, what is the intent for using the Publisher property? Is it just for the visual confirmation? Because the field is not returned to the client in any of the APIs.
When you say “you know”, do you mean “you” as the app developer, or you need to know that for the logic of the application?
So I know what pictures belong to what users. Is there an easier way ?
Application logic. I don’t need to know as a person. I need to be able to grab all pictures by an arbitrary user.
Create a table called Files (or whatever you want to call it). In the table you can declare two columns:
- User (as a one-to-one relation to the Users table)
FileURL