Document contains no data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jvic
Forum Newbie
Posts: 7
Joined: Mon Oct 06, 2003 2:04 pm

Document contains no data

Post by jvic »

When uploading some files, i get this message:

"Document contains no data".

It seems like the browser doesn't even start the upload, because it's right after i click the "upload" button (really fast). I've tested with many browsers, always get the same error.

Any suggestions?

Victor.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

It would help if you posted the code you're using to upload the file(s).

-Nay
jvic
Forum Newbie
Posts: 7
Joined: Mon Oct 06, 2003 2:04 pm

Post by jvic »

Well, the "Document contains no data" appears too fast, which makes me think it isn't even processing the PHP code responsible for doing the upload. As for the HTML code, this is it:

Code: Select all

<form name=anexar action=anexar_arquivo2.php enctype="multipart/form-data" method=post onSubmit=return(validar(this));>
<input type=hidden name=PHPSESSID value=9fac0a39b098dd979ede09fe66c2057b>

<font class=text>Pressione o botão Browse (ou Procurar) abaixo para selecionar o arquivo a ser anexado  em seguida, pressione OK para prosseguir.<br>
  (arquivos .ZIP podem ser enviados e descompactados posteriormente)</font><br><br>

<input type=hidden name='MAX_FILE_SIZE' value='30000000'>  
<input type="file" name="arquivo" class=text><br>

<input type=submit value='Ok' class=text>
<input type=button value='Cancelar' onclick=Atualiza();self.close(); class=text>

<input type=hidden name=cod_curso value=3>
<input type=hidden name=diret value=''>
</form>
Victor.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

ok that's good but what about the php code to upload? can yoıu send it, too?
jvic
Forum Newbie
Posts: 7
Joined: Mon Oct 06, 2003 2:04 pm

Post by jvic »

Yes i can, but i see no point in doing it (for reasons i've explained). Anyway, this is the function responsible for doing the upload:

Code: Select all

function RealizaUpload($arquivo,$destino) &#123;

  if (eregi("php$", $destino))
     $destino.=".txt";

  $r1=move_uploaded_file($arquivo,$destino);
  if (file_exists($destino)) &#123;

    $r2=chmod($destino,0644);
    return $r1;

  &#125;
  else &#123;
    return false;
  &#125;

&#125;
Victor.
Post Reply