1
makakazo
Issue with file upload
  • 2007/2/20 11:44

  • makakazo

  • Just popping in

  • Posts: 10

  • Since: 2007/1/11


Hi, I'm trying to upload a file for my module but I'm not getting past through the basics.

This is the code I have:


include_once ('admin_header.php');

if(!isset(
$_POST['pulsacion'])){
    
$parseForm = new XoopsThemeForm('Enviar archivo de estadísticas''parse_form''prueba_parse.php');
    
$parseForm->AddElement(new XoopsFormFile('Enviar fichero','envio'1000000));
    
$parseForm->AddElement(new XoopsFormButton('''pulsacion''Enviar''submit'));
    
$parseForm->display();
}
else{
    
print_r($_POST);
    echo 
"

"
;
    
print_r($_FILES);
}

xoops_cp_footer();

?>


And this is the output I get when I try to upload a file:
Array ( [MAX_FILE_SIZE] => 1000000 [envio] => 2007-02-19_23.46.39_results_race.zip [xoops_upload_file] => Array ( [0] => envio ) [pulsacion] => Enviar )

Array ( )


I've tried different mime types but it won't work with any. Maybe this is just a basic php mistake I'm having, but I don't know where is the problem. I think the $_FILES array should have the file info after I submit the form.

Can anyone help me?

2
makakazo
Re: Issue with file upload
  • 2007/2/20 13:44

  • makakazo

  • Just popping in

  • Posts: 10

  • Since: 2007/1/11


OK, I found the problem. I was missing this line

$parseForm -> setExtra('enctype="multipart/form-data"');


I guess this is a common thing when you have poor HTML knowledge and it's your first time building a form to submit files.

Login

Who's Online

305 user(s) are online (155 user(s) are browsing Support Forums)


Members: 0


Guests: 305


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits