Issue with HTTP PUT Request for Image Upload - Content-Type Header Not Updating

195 views
Skip to first unread message

Florian Denis

unread,
Nov 3, 2023, 9:51:18 AM11/3/23
to Tasker

Hello everyone,

I've run into a snag while trying to upload an image using the HTTP PUT method. My main issue lies with the Content-Type header in the HTTP request.

Despite setting the header to Content-Type:image/jpg, the server doesn't seem to acknowledge this and defaults to Content-Type: application/octet-stream. This is perplexing because I need the server to recognize the payload as an image to be processed correctly.

Has anyone encountered a similar issue or have any insights on why the header might not be updating? Here are the things I've confirmed so far:

  • The header is correctly set to Content-Type:image/jpg.

  • The server is currently handling it as Content-Type: application/octet-stream instead.

Interestingly, when I use Postman to send the request, everything works as expected, which leads me to believe that the issue is not with the server but possibly with the way the request is being sent from my application.

Any advice, insights, or suggestions would be greatly appreciated!

João Dias

unread,
Nov 3, 2023, 10:18:52 AM11/3/23
to tas...@googlegroups.com
Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Florian Denis

unread,
Nov 3, 2023, 10:21:46 AM11/3/23
to Tasker
Here it is:

Tâche: Upload Http
    
    A1: Requête HTTP [
         Méthode: AJOUTER
         En-têtes: Content-Type:image/jpg
         Fichier à envoyer: DCIM/Tasker/%NAMEP.jpg
         Délai (Secondes): 60
         Structure Output (JSON, etc): Activé ]
    
    A2: Flash [
         Texte: %http_headers()
         Continuer la tâche immédiatement: Activé
         Dismiss On Click: Activé 

João Dias

unread,
Nov 3, 2023, 10:53:18 AM11/3/23
to tas...@googlegroups.com
Thank you! Can you please try this version? https://drive.google.com/file/d/1YGuMAWRfyYlUKMdgb4xyVEUfddWz_zzI/view

If you want you can also check any previous releases here: https://drive.google.com/drive/folders/1GW55YKFiuOZhJVswnt_BQUCJoGm36ugF

Florian Denis

unread,
Nov 3, 2023, 11:06:14 AM11/3/23
to Tasker
It works now! You are awesome ! 
Thank you so much.

For my knowlegde, what was the problem ?

Regards

João Dias

unread,
Nov 3, 2023, 1:41:41 PM11/3/23
to tas...@googlegroups.com
I forgot to check if Content-Type was already set and was always setting it to the one you saw 😅


Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/46498e0e-6e42-4bb6-b02b-250c32f52f6an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages