The function now accepts an argument.
The argument is supposed to be a must but we have to be sure that if it is not
will be properly escaped by jQuery. <-- TO DO
Check if a valid ID has been passed to the function.
We build our form item assigning to "attachment" attribute the id value we got back from the server.
Function to upload a file via AJAX.
This function checks if there is a file and if the response is positive proceeds with
constructing an AJAX call that will finally save the file on the server and give us
back the ID of the file from DB.