Thanks!
I am a designer and don't know php so am trying to cobble this together.
So far I have added a hidden image TV value to my form html:
<input id="image" name="image" type="hidden" value="[[+fi.image]]" />
Then I inserted the new last line in my formit2file snippet
// clean up file name and make unique
$filename = mb_strtolower($filename); // to lowercase
$filename = str_replace(' ', '_', $filename); // spaces to underscores
//$filename = date("Y-m-d_G-i-s_") . $filename; // add date & time
// full path to new file
$myTarget = $target_path . $filename;
$hook->setValue('image','$myTarget');
However the line - $hook->setValue('image','$myTarget'); is adding just the text
$myTarget to the TV, this is great as something is being added to the TV but obviously not the generated path.
So clearly my php here is wrong. I just need to have the myTarget value inserted here, what am i doing wrong?