NetTalk Central

Author Topic: Saving an Image Path NAME STRING in a TPS file.  (Read 4431 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Saving an Image Path NAME STRING in a TPS file.
« on: November 24, 2015, 06:46:20 PM »
Hi there,
my earlier posts refer,
 I am trying to save  an image path string into a tps file.

My Nettalk template has coded this...
and the STOP statement returns the full path name,which is good cause thats what I want to save.

 ! End of "Set File Name"
  p_web.SaveImage('LOG:Photo',loc:filename,p_web.GetValue('_image_'))
  LOG:Photo = loc:filename
  p_web.SetSessionValue('LOG:Photo',LOG:Photo)
  ! Start of "Save File"
  ! [Priority 5000]
  STOP('LOG:Photo= '& log:Photo)
  ! End of "Save File"

Somewhere I want to save this full path name string into a string field in the LOG TPS  file in the field LOG:Photo ( LOG:Photo is a string 255)


This is happening on a FORM
and I need the path saved on Insert and Update.
but Im not sure of the embed point or the code to use
Can you please help?
Thanks
regards
Richard

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Saving an Image Path NAME STRING in a TPS file.
« Reply #1 on: November 26, 2015, 01:48:49 AM »
Using a STOP is a bad debugging idea, and can prevent your server from working correctly.
Use p_web.TRace instead, and view the output in Debugview.

For information on what to embed, and where, an example is required.

cheers
Bruce

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Saving an Image Path NAME STRING in a TPS file.
« Reply #2 on: November 26, 2015, 11:02:56 PM »
Hi Richard,

Not withstanding Captain Bruce's comments ..

If you're talking about having a netwebform with a file upload field on it, and you want to save the selected file (if uploaded) on insert or update, that's relatively straight-forward.

1. Assuming that the form is a FILE form for the tps file, In the ValidateAll, End embed, after running any manual code checks you need to (like is the filename not empty and does the file exist), put:

Code: [Select]
LOG:Photo = loc:filename
2. If the form is not for the tps file, then in that same embed you'd want to write some record retrieval and save code to wrap the above line.

** Another option is to create a routine that has the check + assignment code and then call it in the PostInsert and PostUpdate routines.

Not sure if that's what you were asking, but there you go.
« Last Edit: November 26, 2015, 11:05:09 PM by Stu »
Cheers,

Stu Andrews

Richard I

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Saving an Image Path NAME STRING in a TPS file.
« Reply #3 on: November 27, 2015, 05:58:23 PM »
Hi Stu,
Many thanks for your post.
I needed the validate All END embed

This is the code  and its working as I want it.

earlier I set LOG:Photo=loc:filename
Im saving the BLOB in a separate folder as Bruce suggested

Cheers
Richard

p_web.trace('log:photo in validateall ='& LOG:Photo)
OPEN(Photolog)
set(Photolog)
phlog:Photo       = LOG:Photo
phlog:name        = p_web.GetSessionValue('Employee')
phLOG:Department  = p_web.GetSessionValue('Department')
phLOG:DateIn      = TODAY()
phlog:timein      = Clock()
phlog:timeout     = Clock()
phlog:mobile      = 1
 access:Photolog.INSERT()


p_web.trace('phlog:phot0 in validateall = '& phLOG:Photo)

Set(Photolog)
loop until access:photoLog.next()
    FILETOBLOB(phlog:photo,phlog:photograph )
    access:Photolog.Update()
END

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Saving an Image Path NAME STRING in a TPS file.
« Reply #4 on: November 27, 2015, 10:29:44 PM »
Great to hear Richard!

It's a never-ending learning experience working with Nettalk. Love it!
Cheers,

Stu Andrews