Hello,

I have this weird issue with my simple upload form for different files.

<form enctype="multipart/form-data" action="mesaje_furnizori.php" method="GET"> 
      <table>
      <tr><td align="right">Va rugam selectati &raquo; </td><td><?php echo $selectare; ?></td></tr>
      <tr><td align="right"><td><input type="file" name="file" id="file"/></td></tr>      
      <tr><td align="right" colspan="2">Fisiere suportate (.*gif,*.jpg,.*jpeg,.*png,.*bmp,.*doc,.*docx,.*xls,.*xlsx) Marimea maxima de: <strong>5MB</strong></td></tr>
      <tr><td colspan="2"><textarea name="mesajTrimis" cols="70" rows="15"></textarea></td></tr>
      </table>
      <input type="hidden" name="trimis" value="ok" />      
      <input type="submit" value="Trimite"/>
      </form>

The file is passed into my TMP.

Array
(
    [file] => Array
        (
            [name] => mesaje.png
            [type] => image/png
            [tmp_name] => /tmp/phpvdjnGr
            [error] => 0
            [size] => 4009
        )

)

The weird part is when I print_r($_REQUEST); The file is not showing up ($_REQUEST) ... can't figure out why ... Please help with this one

Array
(
    [furnizor_selectat] => 12555
    [mesajTrimis] => test
    [trimis] => ok
    [PHPSESSID] => 5pkk0q1ou8dkk46etqmsldprh4
    [__utma] => 48988665.324662620.1320745888.1321512004.1321522554.23
    [__utmb] => 48988665.5.10.1321522554
    [__utmc] => 48988665
    [__utmz] => 48988665.1320745888.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
)

Notice: Undefined index: file in /web/sites/blabla.com/mesaje_furnizori.php on line 156

Recommended Answers

All 7 Replies

Pls read my signature, I don't want to yell at you :)

Hey Steve, I know :)

Tha problem is that with GET is working but with POST and REQUEST is not.

mesaje_furnizori.php?furnizor=53443&file=mesaje.png&mesajTrimis=adsdasd&trimis=ok

This is the weird part ...

Hey Steve, I know :)

Tha problem is that with GET is working but with POST and REQUEST is not.

mesaje_furnizori.php?furnizor=53443&file=mesaje.png&mesajTrimis=adsdasd&trimis=ok

This is the weird part ...

If I have to help you have to remove that bad $_REQUEST and we can then troublshoot together. PHP should remove REQUEST alltogether!

Steve,

I have no REQUEST on this page, at all, but my file POST is not submitting with method="POST" only with method="GET"

<?php
if(isset($_GET['mesaj']) && $_GET['mesaj'] == 'nou')
{
?>
      <form enctype="multipart/form-data" action="mesaje_furnizori.php" method="POST"> 
      <table>
      <tr><td align="right">Va rugam selectati &raquo; </td><td><?php echo $selectare_furnizor; ?></td></tr>
      <tr><td align="right"><td><input type="file" name="file" id="file"/></td></tr>      
      <tr><td align="right" colspan="2">Fisiere suportate (.*gif,*.jpg,.*jpeg,.*png,.*bmp,.*doc,.*docx,.*xls,.*xlsx) Marimea maxima de: <strong>5MB</strong></td></tr>
      <tr><td colspan="2"><textarea name="mesajTrimis" cols="70" rows="15"></textarea></td></tr>
      </table>
      <input type="hidden" name="trimis" value="ok" />      
      <input type="submit" value="Trimite"/>
      </form>
<?php
}



if(isset($_POST['furnizor_selectat']) || isset($_POST['file'])  || isset($_POST['mesajTrimis']) || isset($_POST['trimite']) && $_POST['trimite'] == 'ok')
{
	$hash = md5(date("H:i:s Y.m.d"));
	
	echo $_POST['file'];
	exit;

And the output is ->
Notice: Undefined index: file in /web/sites/blabla.com/mesaje_furnizori.php on line 154

isset($_POST['file'])

Anything with tag "<input type="file"" goes to $_FILES not $_POST

That was my problem :) thank you!!

close the thread and never use REQUEST again ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.