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:

<?php 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 "<br><br>"; print_r($_FILES); } xoops_cp_footer(); ?>


And this is the output I get when I try to upload a file:
le="color: #000000"><?php 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

le="color: #000000"><?php $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.