NetTalk Central

Author Topic: Problem Uploading file when updating form  (Read 3462 times)

willieb

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
Problem Uploading file when updating form
« on: March 11, 2015, 04:18:56 AM »
Hi,

I am running into the following problem.

When I insert a record, and upload a image, I run source(at save file embed) to resize, then rename & copy to another folder.  And it works 100%.

My problem lies when Updating a record and uploading a new image.

I, open the record, upload new image, it gets resized, renamed and copied 100%, the file is on the server but the image field on the record is saved with the uploaded file name instead of the new filename.  It seems like the "file upload" variable is not updating and I do not know why.  And this only happens when updating the record.

Any suggestions?

willieb

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
Re: Problem Uploading file when updating form
« Reply #1 on: March 13, 2015, 02:24:45 AM »
Fixed (found solution)

...before uploading a new image, I clear the variable, now it saves like is should.

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Problem Uploading file when updating form
« Reply #2 on: March 17, 2015, 06:00:47 AM »
Willie,

Thanks .... that really helped with a similar problem I have, but if I could ask anyone else watching.... were is the uploaded filename kept?

If this is a change to an existing file, the 'save' routine has the OLD filename set, not the INCOMING one..
===============================
SaveFile::pla:PhotoFname  Routine
  data
  code
  stop('pre:' & pla:PhotoFname)       <=============== existing file name NOT incoming file name
  pla:photofname = p_web.gsv('pla:photofname')   <========== just a check, I'm still not 100% sure when I need to get the variable!!!
  stop('post:' & pla:PhotoFname)
  locName = st.FileNameOnly(pla:photofname)
  locPath = st.pathonly(pla:photofname)
  locExtension = st.ExtensionOnly(pla:photofname)
  pla:PhotoFname = clip(locPath) & '\' & 'Player' & format(p_web.gsv('pla:URN'),@n05) & '.' & today() & '.' & clock() & '.' & clip(locExtension)
  p_web.ssv('pla:PhotoFname',pla:PhotoFname)
  p_web.SetSessionValue('_save_pla:PhotoFname',pla:PhotoFname)
  p_web.SaveFile('pla:PhotoFname',pla:PhotoFname)