Good afternoon, everyone.
I have a task:
1)My app needs to download a file from a global server(so far, google drive)
2) send this file to the local server via the post method.
through the browser, I can go to my local server, select a file and upload it, but I need to automate this process. So this is what the app should do.
The first point was successful, the file is downloaded and I know the path to it.
but with the second point of the problem:
I tried a large number of different ways to send the file: this is the standard web. post and different extensions, and even tried to run the JS code from the application that was supposed to solve the same problem( the code was generated by the POSTMAN program) and each time I fail.
I saw several similar topics on the form, but my task will be solved by the fact that I can't change the script on the server, I need to send exactly the form that the server needs.
With great respect to the community, I ask for any help. on demand, I will add any materials
Thank you for your answer, but my problem is not in Google drive at all, I need to transfer the file by the post method to the local server implemented on esp8266
Please excuse me if I did not express myself correctly, unfortunately I can only communicate with you with the help of an interpreter. In the text of my question, I said that there are two tasks: the first is to download a file from the global server, the second is to upload this file to a local server (the role of which is performed by esp8266). I managed the first task, but there were problems with the second one.
Я использую esp8266-7e(f). Прошивка на ней написана мной через Arduino ide.
Для того, что бы иметь возможность OTA обновлений, я добавил в прошивку библиотеку<ESP8266HTTPUpdateServer.h>, пример использования которой есть здесь: http://psenyukov.ru/прошивка-по-воздуху-контроллера-esp8266-v2-0/
Для реализации OTA в прошивке я вхожу в бесконечный цикл при уникальном событии( например команда build полученная по udp).
Когда esp находится в этом бесконечном цикле, на неё можно зайти через браузер (например 192.168.4.1/firmware) там будет форма выбора файла и кнопка загрузить.
Вся работа с html и post скрыта в библиотеке и даже найдя её исходные файлы, я не смог понять как она работает.
По этому задача и сводится к тому, что бы отправить на esp форму post запроса, которая содержит .bin файл и всё.
Касательно версии Android, у меня 10 версия, но должно работать на любой современной версии
That's not to do with the comms, it's to do with Google Security measures. Technically, your Android 10 App may store files in only two directories (folders):
App Specific Directory (aka ASD)
App Private Directory (aka Assets)
This may mean that although you know the path to file 'Shipment.Bin', Android is not allowing access to it.
Please do not use acronyms in your posts.
Given that you have written the script, we should know exactly what is required. You can't just send something and hope for the best, as you have already discovered. If "that's it" you wouldn't be here now seeking technical support
Shipment.bin - is it actually binary file? As you can see from my post that you have referred to, only certain types of file qualify for the process.
You have adapted my code but the result was the Error message 1104. As discussed in my previous post, that might be down to file type and/or file path.
If you try the attached Project, build an APK for the test, do you get the same error message? Use the 'Pick' button to select a .jpg or .png file from your phone's gallery, then the 'Post' button to send.
Shipment.bin это действительно двоичный файл который генерирует Arduino ide (инструменты-экспорт бинарного файла) в котором содержится прошивка для esp8266.
после загрузки файла, библиотека <ESP8266HTTPUpdateServer.h> самостоятельно обновляет прошивку на микроконтроллере и перезагружает его.
Я проверил ваш проект, собрал и запустил на телефоне, вот результат:(изменил только ip адрес на актуальный)
We know the Test has a legitimate file path and file type, which should mean that the issue is either with the method of posting, the syntax, the URL or the device itself (it's script).
If I run the Test, sending an image to my Website, no error is reported.
So I think there isn't an error on the send side, but on the receive side. I assume the manufacturer instructs you to add /firmware to the end of the URL?
Another hurdle is the file Content-Type. It should exist in the Web API list of types, but bin (binary) is not listed.
Да, так было прописано изначально. я могу изменить эту строчку в прошивке esp8266, но не вижу необходимости.
Так же в прошивке задан порт http сервера - 80:
I have spent some time perusing the internet to see if anyone offers a solution in any programming language. There one or two, but none of them are using Web Api, they are using bespoke APIs that App Inventor does not have access to.
Taifun has a WiFi Extension that uses SSID, Service Set IDentifier, the name of your network. That might be worth looking into.
I'm going to ask my Power User colleague Juan if he knows a way to flash update an ESP8266 via an App + WiFi.
Большое спасибо за ваше активное участие.
Касательно WiFi от Taifun можно по подробнее? Пока не увидел, что в этом расширении может помочь в решении нашей проблемы