That code works for me up to a point. If I comment the condition below, it is putting all of my fields into the database, except for the image filename. There is no image being uploaded and the condition below is never returning true:
if($fields['image_name']) &&$_FILES['image_name'])
It is the portion $_FILES[’image_name’] that is always false.
I have tried with $_FILES[’image’] also... (Question is $_FILES[’image’] a special global variable...?)
My form looks like this:
[+validationmessage+]
<form method="post" action="[~[*id*]~]">
<input type="hidden" name="formid" value="feedbackForm" />
<p><label accesskey="t" for="title">Title</label>
<input type="text" name="title" maxlength="60" /></p>
<p><label accesskey="body" for="body">Body</label>
<textarea cols="40" rows="10" name="body" eform="Comments:html:1"></textarea></p>
<p><label accesskey="i" for="image_name">Image</label>
<input name="image_name" type="file" />
</p>
<p><input type="submit" name="submit" value="Submit"></p>
</form>
And my snippet call looks like this:
[[eform2db_image]]
[!eForm? &formid=`feedbackForm` &eFormOnBeforeMailSent=`eform2db_image` &tpl=`eFeedBackForm` &report=`eFeedbackReport` &thankyou=`eFeedBackThanks` &noemail=`1` !]
Any ideas what I might be doing wrong?