$_FILES empty - cannot upload files!

ogosensedan 05 Mar, 2009
Hello

I downloaded Chronoforms v2.3.9 recently and installed it. I created a simple upload form:
										
<form name="ChronoContact_FileUpload" id="ChronoContact_FileUpload" method="post" action="index.php?option=com_chronocontact&task=send&chronoformname=FileUpload">
		
				<table width="250">
<tbody><tr>
<td width="100">File</td>
<td><input id="myFile" name="myFile" type="file"></td>
</tr>
<tr>
<td>Artist</td>
<td><input name="artist" type="text"></td>
</tr>
<tr>
<td>Song Title</td>

<td><input name="title" type="text"></td>
</tr>
<tr>
<td>Image</td>
<td><input id="myImage" name="myImage" type="file"></td>
</tr>
<tr>
<td colspan="2"><input value="submit" type="submit"></td>
</tr>
</tbody></table></form>


I set the form to allow file uploads, and set this myImage:jpg|gif,myFile:mp3|wav

However, my files weren't in components/com_chronocontact/uploads - the folder was empty. It stayed like that even after I logged into shell, changed the ownership of the whole components folder to user:apache (it was apache:apache before).

When that didn't work, I inserted a bit of the code inside uploadandmail() function:
$t = "";
foreach($_FILES as $k => $v)
		$t .= "$k : $v\n";
	foreach($_POST as $k => $v)
		$t .= "$k : $v\n"; 
	mail("myemail@mydomain.com", "blah blah", $t);

(of course, [email]myemail@mydomain.com[/email] is set to my e-mail).
As a result, ALL I get is this:
(on the results page:)

Notice: Undefined index: myFile in /home/user/public_html/components/com_chronocontact/chronocontact.php on line 230
Notice: Undefined index: myFile in /home/user/public_html/components/com_chronocontact/chronocontact.php on line 231
Notice: Undefined index: myImage in /home/user/public_html/components/com_chronocontact/chronocontact.php on line 230
Notice: Undefined index: myImage in /home/user/public_html/components/com_chronocontact/chronocontact.php on line 231


Line numbers might be a bit changes because of entered code, but the error is not with code - I simply entered few foreach loops to printout / email me some results during debugging.

And in the e-mail, as a result of second foreach (one that loops through $_POST) I get:
myFile : hello.mp3
artist : dada
title : 1234567865432
myImage : kjhg.jpg


What's going on here?

Thank you,
Daniel
GreyHead 05 Mar, 2009
Hi ogosensedan,

Most likely you need to add enctype="mulitpart/form-data" in the Form Tag Attachment box in the General Tab.

Bob
This topic is locked and no more replies can be posted.