 <p>I think I basically did what prodigitalson suggested...</p> <p>I <code>include()</code> a call to a php file that inserts a new shot(same query as in my question)</p> <p>Then I <code>include()</code> another call to another php file that selects this new row I just inserted and assigns each column of the result row into variables and then into session variables</p> <p>Then the session variables are used in my script that uploads the image to my server with the <code>image filename</code> and also creates a thumbnail image based on my <code>shrunk image filename</code>.</p>