I have a form like this
<form method="post" enctype="multipart/form-data">
<input type="text" name="field01">
<input type="file" name="file01">
<button type="submit" name="update">Update</button>
<button type="submit" name="new">Save New</button>
</form>
It contains different input fields like in the example above.
Now I am experiencing a strange behaviour. I added the enctype later after testing my MySQL Inserts / Updates etc. That works as expected. The file upload works as well, but now I have the problem, that my INSERTs does not work anymore using the multipart/form-data. Strangely my UPDATEs does work together with my image uploads. If I remove the enctype, my INSERTs do work, but my file uploads obviously not.
My POST Data is also correct in both (INSERT / UPDATE) cases, also the PDO Statement (checked it using queryString). As I said, it works.
How button type="submit" are handled with this type of form? I already tried input type="submit" to check if that's the problem, but the result is the same.
ok, I figured it out. The problem was not the multipart, it was that I was saving the filename of the images in the database. But if multipart is activated, the content is binary (even if no file is set). That caused the problem and the INSERT failed.
I suppose UPDATE ignores fields which cannot be updated and leaves them empty?