REQUEST upload problem ...
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 » </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['file']) ... 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
szabizs
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 10
Solved Threads: 5
Pls read my signature, I don't want to yell at you :)
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
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 ...
szabizs
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 10
Solved Threads: 5
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!
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
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 » </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
szabizs
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 10
Solved Threads: 5
isset($_POST['file'])
Anything with tag "$_FILES not $_POST
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
That was my problem :) thank you!!
szabizs
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 10
Solved Threads: 5
close the thread and never use REQUEST again ;)
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392