Where are my $_FILES? Ajax Uploading
Posted
by Richard Testani
on Stack Overflow
See other posts from Stack Overflow
or by Richard Testani
Published on 2010-04-12T02:15:52Z
Indexed on
2010/04/12
2:23 UTC
Read the original article
Hit count: 354
I've built a form to upload images, and processed with Prototype/PHP.
$('image_upload').observe('submit', function() {
var params = $H();
params.set('name', $('image_title').value);
params.set('from', $('from_who').value);
params.set('upload_file', $('upload_file').value);
new Ajax.Request('/files/upload_process.php', {
method:'post',
parameters: params,
onSuccess: function(r) {
$('uploadbox').update('<img src="/images/interface/thankyou.png" />');
}
})
});
The form itself sends the data to the server, but when I try to output print_r($_FILES['upload_file']);
nothing appears, not even an empty array.
If I output print_r($_POST)
, the parameters are sent properly, but only the file name of the image.
So it seems the files themselves are not being sent along. How do I handle this? Thanks Rich
© Stack Overflow or respective owner