Support Topics Documentation Slack YouTube Blog

File upload from Appgyver

Hi there,

I am struggling to upload a file from Appgyver. In the documentation I find

https://backendlessappcontent.com/<application id>/<REST-API-key>/files/<path>/<file name>

I assume the ‚file name‘ is the name of the file at the destination.

E.g., the Appgyver flow ‚Pick image from library‘ gives me a file path on the phone. Where/how do I include this file path to be uploaded?

Thank you and best regards,

Joerg

Please, show your request in a plain form like curl.
What error do you receive during uploading?

The local path on the phone is really irrelevant to the path on the server. The <file name> part in the URL is exactly what it is - the file name. For example index.html

Hey guys,
I’ve been reading all the posts and related documentation and I’m having trouble getting started for this. I’m running appgyver and trying to upload an image to backendless. Do I use a File API? or a Data API? I created a REST API call in appgyver with the url formatted as per above but I dont actually know what to do with it. Can anyone give me a hint at how I provide the source file path on my phone to be uploaded to a destination file in backendless? And what API do I use to achieve this?
Tks

If you need to store the image in the database - you use the Data API
If you need to store the image in the file (recommended) - you use the File API.

Getting the source path for a file on your phone - it would be a question for the AppGyver team since AppGyver controls the client-side environment.

Regards,
Mark

Thanks Mark, yes I’ll use the File API then and I can find the path on my phone no problem. So then do I use the copy file API? I’ve tried this just using a basic image file already saved in my web folder on backendless and get this error:

{
“code”: 6007,
“message”: “The specified resource was not found”,
“errorData”: {}
}

Here are the URL’s I’m using:
From: https://backendlessappcontent.com/'app id’/‘rest key’/files/web/images/Gym.jpg
To: https://backendlessappcontent.com/'app id’/‘rest key’/files/web/images/Gym2.jpg

You can use the “Copy File/Directory” when you need to copy a file that already exists in the Backendless file storage to another directory.
Please use the following doc to see the semantics for the “from” and “to” arguments:
https://backendless.com/docs/rest/file_file_copy.html

Regards,
Mark

Ok but if I want to upload a local file on my phone to backendless what File API function would I use?

You would use this:

https://backendless.com/docs/rest/files_file_upload.html

Haha thanks, I found that just as you were replying. Sorry and thank you Mark.

Getting closer…

Getting error:
{“code”:8002,“message”:"Could not parse request with message: Missing boundary header, status code 400](File Uploading error. {"code":8002,"message":"Could not parse request with message: Missing boundary header, status code 400)

Which I see another post on this and your response, but I still dont understand what needs to change.

My REST call looks like this:
https://api.backendless.com/'app id’/‘rest api’/files/web/images/image.jpg?overwrite=true

and I’m passing it {fileURL: pageVars.imageUpload} where the imageUpload is a path (file:///var/mobile/containers/etc/etc) to the image file.

How close am I?

Ok I found the multi-part/form data piece that should form the request body.
Trying to figure out how to send an image in multi-part/form data now… any suggestions welcome!

Hi, @Joel_Maclean

After selection a mandatory header (multi-part/ form) you need to select in the request body the form-data type and as a value the full path to this file on your device.
As example my curl looks like this:

POST https://api.backendless.com/<application-id><REST-api-key>/files/Exapmle.png \

--header 'Content-Type: multipart/form-data' \

--form '=@"/path/to/file"'

Regards,
Marina

Thanks Marina, but I’m having trouble figuring out where to put this information.

I have a REST URL, a header, and a payload. Where do I put the --form ‘=@"/path/to/file"’ piece?

Hi Joel,

I think that question would be better addressed to AppGyver’s support. We can assist with backendless api, our own UI Builder, but when it comes to third party tools, we cannot provide support for them.

Regards,
Mark

@Joel_Maclean - did you have any luck with this? I am getting nowhere at the moment! I am going thru the appgyver documentation and forums and no such luck

Just curious, guys…is AppGyver support pretty much non existent?? @sim_sim @Joel_Maclean ?

Yea no progress @sim_sim , I posted in Appgyver forums to ask for paid help and can’t seem to get anything going. A few guys replied but no one responds outside of the forums.

@mark-piller basically yes, they warn the users that its not supported and that they rely on community support. Trouble is the ‘community’ is very small

@mark-piller I do think it complements your product quite well. I did try to use your front end but the functionality has a ways to go to catchup to Appgyver, also Appgyver has a build component that allows us to build packages to publish in the app stores and web app servers.

Here is a screen shot of where you configure an API call, as you can see there’s an option to set a header, but not sure where to go with the --form piece @Marina.Rudenko mentions. Happy to entertain any suggestions here :pray:.

Looks like it clearly falls behind our UI system in the file upload area…:wink:

Is it just the ability to build a native app that attracts you, @Joel_Maclean ? I would like to understand where we fall short from your perspective.

Thank you for the feedback, it does help us build a better product.

Regards,
Mark