1

I have tried calling Drupal file service from android and it is storing images in application/octet format and not in image/jpeg format in file_managed table.

$data['file'] ='encodedimage';
$fid = file_save_data($data);

So I thought I will call file_save_data($data) to store images where I pass the image as encoded string. But it is still storing in application/octet format and not in image/jpeg.

Can somebody help me to store as image/jpeg format into file_managed table?

1 Answer 1

0

The Services module provide an easy to use web services enpoint to create file which do all the heavy PHP work for you.

In file_save_data(), the mime type of the file is derived automatically, likely from its filename. You can set the filename of the saved file by using the $destination argument.

1
  • problem in using services module is in filemime type it is storing as application/octet so i wanted it to be image/jpeg
    – Naveen
    Commented Jun 15, 2014 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.