I think there is a problem with Filename in MULTIPART

While using variables posting images doesn’t work

CLOG Yellow "==================***Upload Image***=================="
BLOCK:ConstantString
LABEL:Post this Constant Image
  value = "K:\\Open Bullet from RDP test Results\\Open Bullet 2\\PureOpenBullet2\\Images\\Picture.jpg"
  => VAR @Images
ENDBLOCK

BLOCK:FileRead
LABEL:Images Read
  path = $"<Images>"
  => CAP @Readimages
ENDBLOCK

BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" @Images "image/jpeg"
ENDBLOCK

Where as even when i place the image in a folder and reference it directly via

CLOG Yellow "==================***Upload Image***=================="
BLOCK:FileRead
LABEL:Images Read
  path = "Image\\Picture.jpg"
  => CAP @Readimages
ENDBLOCK

BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" "Images\\Picture.jpg" "image/jpeg"
ENDBLOCK

The only time it seem to work is when i place the image directly in OpenBullet directory

//Just to view image READ
BLOCK:FileRead
LABEL:Images Read
  path = "Picture.jpg"
  => CAP @Readimages
ENDBLOCK
//Actual UPload
BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" "Picture.jpg" "image/jpeg"
ENDBLOCK

I don’t know if it’s a bug. I just wanted to report it.

Do you have something else accessing that image?
What version of OB2 is it?
Can you try to restart OB2?
Open an issue on github if it persists

There is nothing else accessing the image.
I am currently on OpenBullet 2 version 0.1.16 [Beta]

I am suspecting it’s an Open Bullet Process which is accessing the image through this block

BLOCK:ConstantString
LABEL:Post this Constant Image
  value = "K:\\Open Bullet from RDP test Results\\Open Bullet 2\\PureOpenBullet2\\Images\\Picture.jpg"
  => VAR @Images
ENDBLOCK
CLOG Yellow "==================***Upload Image***=================="
BLOCK:ConstantString
LABEL:Post this Constant Image
  value = "Images\\Picture.jpg"
  => VAR @Images
ENDBLOCK

BLOCK:FileRead
LABEL:Images Read
  path = @Images
  => CAP @Readimages
ENDBLOCK

BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" @Readimages "image/jpeg"
ENDBLOCK
CLOG Yellow "==================***End Image***=================="

Alright so basically it’s not closing the handle, please open an issue on github (with a link to this post) and I will address this as soon as I can.

By the way, the last screenshot you sent shows a totally different error, which is caused by your code. You are reading the contents (as string) of the file by using this

BLOCK:FileRead
LABEL:Images Read
  path = @Images
  => CAP @Readimages
ENDBLOCK

and then doing

CONTENT:FILE "imagen_0" @Readimages "image/jpeg"

This is wrong, you need to give it the path to the file on disk, you don’t have to read the file yourself.

CONTENT:FILE "imagen_0" "Images\\Picture.jpg" "image/jpeg"

Can you please try this?

I previously tried this

CONTENT:FILE "imagen_0" @Readimages "image/jpeg"

It didn’t work.

Did you even read what I wrote? I said “this is wrong” right below the snippet you pasted. I wrote it to explain to you what exactly was wrong.
This is the correct way to do it.

CONTENT:FILE "imagen_0" "Images\\Picture.jpg" "image/jpeg"

Please don’t just stop at the first code snippet and read the full thing, for the love of god…

Yes i know, not to declair the part like this “Images\Picture.jpg”. It’s non of my intension to use it this way. I actually want some some sort of variable as input for the images.

something like this

CONTENT:FILE "imagen_0" @Readimages "image/jpeg"

But when i tried it. It didn’t work. the Variable Readimages is supposed to vary the part to the image which is supposed to be uploaded at each pass.

BLOCK:FileRead
LABEL:Images Read
  path = @Images
  => CAP @Readimages
ENDBLOCK

BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" @Readimages "image/jpeg"
ENDBLOCK

But it doesn’t work as intended atleast from my point of view.

Mate, File Read will read the CONTENTS of the file. You don’t have to read the contents!!! OB2 does it automatically you just need to give it the name of the file. Do you understand? You DO NOT need a FileRead block in order to upload files. You just need to give it the path to the file so it can know where to read it from.

YEAH… I know i don’t have to read the content. I just wanted to make sure READing Images works. This is eactly what i wanted I was able to find a solution.

BLOCK:GetFilesInFolder
LABEL:Get Images In Folder
  path = "Images"
  => VAR @imagesOutput
ENDBLOCK
FOREACH path IN imagesOutput
CLOG Yellow "=========================Before-Upload======================="
BLOCK:HttpRequest
LABEL:Upload Image Post Ad Page
  url = "https://example.com"
  method = POST
  customHeaders = {}
  TYPE:MULTIPART
  "WebKitFormBoundaryyG1Z7NAaYwlZEmw1"
  CONTENT:FILE "imagen_0" @path "image/jpeg"
ENDBLOCK
CLOG Yellow "=========================After-Upload======================="
END