Ok, I came up with a two step solution. It is kind of a hack and I had to modify the FileUpload snippet, but it doesn’t seem to impact its use. Here is how I did it.
NewsPublisher Page
[!NewsPublisher? &folder=`4039` &template=`Posts Template` &formtpl=`post` &clearcache =`1`!]
post CHUNK (formTPL)
<form enctype="multipart/form-data" name="NewsPublisher" method="post" action="[~[*id*]~]">
<input name="NewsPublisherForm" type="hidden" value="on" />
Page title:<br /><input name="pagetitle" type="text" size="40" value="[+pagetitle+]" /><br />
Content:<br /><textarea name="content" cols="50" rows="8">[+content+]</textarea><br />
<input type="hidden" name="formid" value="[+fileupload.formid+]" />
<input type="hidden" name="MAX_FILE_SIZE" value="[+fileupload.maxsize+]" />
<input name="send" type="submit" value="Submit" />
</form>
So far nothing, out of the ordinary.
I have modified FileUpload to rename the uploaded file to the id of the newly created page from NewPublisher.
// rename file
$type = substr(strrchr($uploadfile, "."), 1);
rename($uploadfile, $path . $modx->documentIdentifier . "_photo." . $type);
There are a few more things that I added too. Here is how I call the new FileUpload, inside a template.
Posts Template (from the NewsPublisher call)
The template specific content...
[*#content*]
<h3>Upload Picture</h3>
[!FileUpload? &tpl=`FileUploadForm`&path=`/assets/files/` &extensions=`jpg` &renameUpload=`1` &updateTemplate=`4113` &goto=`4039`!]
I have added three new parameters to my "hacked" FileUpload snippet.
&renameUpload = rename the file uploaded to the document id
&updateTemplate = is the id of the the template to change the post to after the photo has been uploaded. I do not want the file upload form to show again.
&goto = is the page to goto after changing the template, 4039 is a page that has a ditto call to display all the posts.
Template id 4113
contains this...
[*#content*]
<p>
<img width="150" src="[(base_url)]assets/files/[*id*]_photo.jpg">
</p>
This is just a simple example. It solves my particular problem. I will probably add logic with PHx to hide the img tag if no photo is found. Also add phpThumb to size the image properly. I hope it helps someone else. I am not a php developer, again I just cut and paste from other snippets and code.
Please download the original FileUpload snippet and then download my modified one to see the changes I made. I also had to delete the cache on the document after I changed the template.