NetTalk Central

Author Topic: Saving an image to the \web\images folder  (Read 442 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 278
    • View Profile
    • Email
Saving an image to the \web\images folder
« on: January 20, 2024, 06:56:40 AM »
Hi,
NT 14.13  C11.0.136
I am trying to save an image to the folders beneath the folder from which the web server is running.  I want to save an image to \web\images  folder.
My code saves the image to the folder from which the web server is running (not the desired subdirectory).

            st5.SetValue(imgref)
            SaveFileName = 'IN_' &   p_web.GSV('JSRV:GUID') & '.png'  ! this is the actual dropoff guid as file name
            RelativeFileName = p_web.MakeWebRelative(SaveFileName)
            ER# =    st5.SaveFile(RelativeFileName)  ! for direct save  1 = success, 0 = fail

I thought that p_web.MakeWebRelative(SaveFileName)  would set the save directory to \web\images but that is NOT the case.
How can I get the pictures to the \web\images folder so that the server can find them and display them later?
TIA,
Ron

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Saving an image to the \web\images folder
« Reply #1 on: January 21, 2024, 10:45:05 PM »
>> I thought that p_web.MakeWebRelative(SaveFileName)  would set the save directory to \web\images

no, "relative" in this case is relative to the web folder.

>> How can I get the pictures to the \web\images folder

add images\ to the front of your filename. As in

SaveFileName = 'images\IN_' &   p_web.GSV('JSRV:GUID') & '.png'