0

What i want to do:

I need to do a POST to a PHP Service using HttpWebRequest, and upload an image file as a Base64(can't change this) string along with other parameters and write the Base64 data in a database.

What i do:

  • So far i am able to upload the Base64 data representing an image
  • PHP side do receive the data and write it to the database

What doesn't work

  • When i am trying to read the Base64 data from the database and write it on the disk, it write the file but i am unable to open the file as an image

Thanks in advance!

SlashJ
  • 687
  • 1
  • 11
  • 31

1 Answers1

1

The problem was actually in the Base64 string where in C# there was some '+' symbols and on the PHP side the '+' were removed for some reasons.

I just added the following line:

$data = str_replace(' ', '+', $data);

Now all work fine.

Thanks!

SlashJ
  • 687
  • 1
  • 11
  • 31