1. Moshe Tangi
  2. PowerBuilder
  3. Monday, 25 June 2018 15:23 PM UTC

Hi all ,

I have   a ws target which one of its functions gets an bytes[] by value .  That array represent a pic file ( jpg , png  ,bmp )  

The function needs to convert this array into a pic file back .

what i am doing now is :

1. Blob()   converts bytes[]  into a blob .

2. FileWriteEx() converts the blob into a pic file ( just a temp.bmp into a temp directory  )

3. CopyFileA()  copies the file from one temp location into another one.

My questions are :

1. Does FileWriteEx() can converts blob into a bmp file ?

2. Why i don't see the BMP file in the temp directory  ? the FileWriteEx() returns > 0 .

3. The CopyFileA()  returns 0 (zero) , Why ? I have checked permissions ( admin) .

Thanks

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 25 June 2018 18:16 PM UTC
  2. PowerBuilder
  3. # 1

Hi Moshe;

A1: No, the FileWriteEx just writes a binary data stream from a BLOB variable to disk. Its up to your PB App to make sure that the data stream is in the correct binary format. There is no conversion.

A2: In a PB Web Service, you cannot write the file to a folder that its outside the Web Service's work area.

A3: Looks like your using an old obsolete SDK function for Copy. PB has its own built-in copy command FileCopy. Note again though that running as a web service, the WS will not allow access to folders by default outside of the WS's work area. However, access is also controlled by the IIS "Application Pool" settings and the folder security privileges within IIS.

HTH

Regards ... Chris

Comment
  1. Moshe Tangi
  2. Tuesday, 26 June 2018 17:45 PM UTC
hi chris ,



thanks ,



two questions :



1. does filewriteex() can write a file other suffix than bmp ?



2. what is the Web Service's work area ?

  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 26 June 2018 18:25 PM UTC
Hi Moshe;



1) Yes, you can use the FileWriteEx ( ) command to create any file type with any appropriate extension name that you need. The command is indifferent to the file extension used. Its totally up to your App.



2) The Web Service's work area is defined where you deploy the WS to under the assigned IIS folder plus, the development path where WS's source code is kept. For example, a WS PBL located at "C:\Dev\PB2017\Moshe" that is deployed to "C:\Ingetpub\wwwroot\Moshe" - the fully qualified path to the WS's deployed area under IIS (aka run-time) will be ... "C:\inetpub\wwwroot\Moshe\file\common\C\Dev\PB2017\Moshe" and the WS's work area will be "C:\inetpub\wwwroot\Moshe_root\file\session\__webservice__\c". This algorithm is consistent for WS placement and execution since PB 11.0



HTH



Regards ... Chris

  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Monday, 25 June 2018 15:37 PM UTC
  2. PowerBuilder
  3. # 2

We would probably have to see more code.  Where is your FileOpen?  Do you open in StreamMode?  Where is your FileClose?  I assume you are closing before you try to copy.

Kevin

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.