Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would normally just create the Bug object and its child, the Attachment object, within the same HTTP response after the user has submitted the form.</p> <p>If I'm reading you right, the user input consists of a single form with the aforementioned fields for bug title, description, and the attached file. After the user fills out these fields (including the selection of a file to upload), then clicks on Submit, your application receives all three of these pieces of data simultaneously, as POST variables in the HTTP request. (The attachment is just another bit of POST data, as described in <a href="http://www.ietf.org/rfc/rfc1867.txt" rel="nofollow noreferrer">RFC 1867</a>.)</p> <p>From your application's end, depending on what kind of framework you are using, you will probably be given a filename pointing to the location of the uploaded file in some suitable temporary directory. E.g., with Perl's CGI module, you can do:</p> <pre><code>use CGI qw(:standard); my $query = CGI-&gt;new; print "Bug title: " . $query-&gt;param("title") . "\n"; print "Description: " . $query-&gt;param("description"). "\n"; print "Path to uploaded attachment: " . $query-&gt;param("attachment") . "\n"; </code></pre> <p>to obtain the name of the uploaded file (the file data sent through the form by your user is automatically saved in a temporary file for your convenience), along with its metadata. Since you have access to both the textual field data and the file attachment simultaneously, you can create your Bug and Attachment objects in whatever order you please, without needing to persist any incomplete data across HTTP responses.</p> <p>Or am I not understanding you here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload