[drupal-devel] Fwd: uploaded image file is included as PHP

Robrecht Jacques robrechtj at gmail.com
Wed Aug 10 13:41:01 UTC 2005

See: http://drupal.org/node/28576.

Robert Douglas said I should send this to the mailinglist.

The problem is that when you upload an image file, this file is
included (as in "include($file)") during preview. This results in
errors like:

Parse error: parse error, unexpected '@' in
/home/demolici/shizzle/images/temp/crazyscrabbledude_0.jpg on line 30

When uploading a GIF file, it seems like the binary file is included
in the HTML source.

The reason for this is "phptemplate": it does a "include($file)" in
"_phptemplate_default" to include a template file (like

if ($file) {

Now if you have a form element called "file" (like in image.module),
somehow there exists a "$variables['file']", so when doing the
"extract($variables)", the local "$file" is overwritten by
"$variables['file']". Obviously the wrong "$file" is then included,
resulting in the error above.

A fix is added to the issue (#28576): before "extract($variables)" I
propose to do a "unset ($variables['file'])". I'm not sure if this is
the right fix.


More information about the drupal-devel mailing list