Drupal error with upload image or upload attachment

Problem:

When you upload an image using the built-in Drupal upload image or even the CCK imagefield feature you receive and error message that looks like raw html.

This problem does not appear consistently some node work some do not. This intermittent problem seems random but is consistent on a given page.

This problem seems to happen from Drupal 4 to 5 did not test with Drupal 6 or later....

 

Solution:

To troubleshoot this issue we recreate a new node and copying the "problem" node values over until the new node had the same problem. The problem was due to the value of one of our textfield. After many "add/removing" of the text field lines, one by one, we were able to conclude that the issue was due to: "select" and "from". These words were on separate lines. Once we removed them the upload featured work just fine. It appears that something is parsing the HTML page for SQL statements.

You can confirm this issue by simply putting "select from" in a text field and you will also experience this attachment upload problem in Drupal.

 

Note: This issue was "troubleshooted" with Drupal 5.23 (using Views and CCK) but I recall having encountered this issue with Drupal 4.x. This is why I decided to write this up.... Hope this help you also!

Besides that pop-up error message, the upload real seems to work. If you save the page (closing the error message) and come back you will see the uploaded image/attachment.
 

Other issue?
Might be a different problem/solution but some had image upload problems and by disabling JavaScript in their browser the problem went away. My guess is that it is probably a different issue.