Im trying to use an updater on a form that has a file field however it
appears that the updater isnt passing the information, heres a
simplified version of the page:
massmailer.php
[code]
<form name="newMessageForm"
id="newMessageForm" action="/demos/
idan/index.php" method="post" onSubmit="return false;"
enctype="multipart/form-data">
<table class="contentBox"
cellpadding="1" cellspacing="1"
style="width: 810px;">
<tr class="row1">
<td><b>Attachment:</b></td>
<td><input
name="attachment" type="file" id="attachment"
size="80" class="button" /></td>
</tr>
</table>
<input type="submit"
class="formButton" value="Send the E-
Mail!" />
</form>
<script type="text/javascript">
var valid = new
Validation('newMessageForm', {immediate : true,
useTitles:true, onFormValidate : ValidateForm});
function ValidateForm() {
switchToHTML();
new
Ajax.Updater('response', 'ajax.php?action=massemail',
{asynchronous:true,
parameters:Form.serialize(document.newMessageForm), evalScripts:true,
onSuccess:function(){ clearForm(); }});
//switchToText();
return false;
}
function switchToHTML() {
if (viewTextMode == 1) {
formatText('ViewSource','message');
}
}
function switchToText() {
if (viewTextMode != 1) {
formatText('ViewText','message');
}
}
function clearForm() {
document.newMessageForm.email_address.value = '';
document.newMessageForm.subject.value = '';
var doc =
document.getElementById('wysiwygmessage').contentWindow.document;
// Write the textarea's
content into the iframe
doc.open();
doc.write('');
doc.close();
}
</script>
[/code]
heres the ajax.php page code
[code]
//================================================
// Mass Email
//================================================
elseif ($_GET[action] == "massemail") {
echo $HTTP_POST_FILES['attachment']['name'] . "<br />" .
$HTTP_POST_FILES['attachment']['tmp_name'] . "<br /><br />";
echo $FILES['attachment']['name'] . "<br />" .
$FILES['attachment']
['tmp_name'] . "<br /><br />";
print_r($_FILES);
print_r($_FILES['attachment']);
}
[/code]
Any ideas whats going on?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---