Click to See Complete Forum and Search --> : Problem with


DaveinLondon
06-12-2006, 08:52 AM
I am processing a form to upload an imageş
which contains:


<form name="main_fm" enctype ="multipart/form-data" action="aaa_process.php" method="POST">
<input type = 'hidden' name='run' value="on">
<input type="hidden" name ="MAX FILE SIZE" value="500000">
<input type = 'hidden' name='adref' value="<?php echo $A_ref ?>">

<div style='position:absolute; left:40px; top:320px' >
<input type="file" size="50" id = "u1" name="upLoad1"><br />
<input type="text" size="50" id = "n1" name="fName1" readonly>
</div>

<div style='position:absolute; left:500px; top:262px' >
<img height='160' width='160' id="image1" style='display:none' />
</div>


<div style='position:absolute; left:370px; top:280px' >
<input type="submit" value="Upload All Images"><br />
<input type="reset" value="Reset All Images" >
</div>

</form>


To help track down the problem, I have set
error_reporting(E_ALL);

In the script I have included an

print_r($_FILES);


This is the output:

Array ( [upLoad1] => Array ( [name] => curlydog.jpg [type] => image/jpeg [tmp_name] => C:\WINDOWS\TEMP\php59.tmp [error] => 0 [size] => 22660 ) )

(Looks fine to me )

But I get this error:

Notice: Use of undefined constant name - assumed 'name' in D:\Web\DW\DWyodbod\aaa_process.php on line 20


line 20 reads:

$N_pix1 = strip_tags(trim($_FILES['upLoad1'][name]));

Does anyone know whats going wrong ?

Thanks

chazzy
06-12-2006, 09:56 AM
because this isn't really valid (and too many people use it assuming it is)


$N_pix1 = strip_tags(trim($_FILES['upLoad1'][name]));


it should be


$N_pix1 = strip_tags(trim($_FILES['upLoad1']['name']));

bokeh
06-12-2006, 10:01 AM
because this isn't really valid
$N_pix1 = strip_tags(trim($_FILES['upLoad1'][name]));
It's perfectly valid if name is a constant.

Huevoos
06-12-2006, 10:36 AM
Notice: Use of undefined constant name - assumed 'name' in D:\Web\DW\DWyodbod\aaa_process.php on line 20

sadly it is not

chazzy
06-12-2006, 10:43 AM
but if you want to be a good programmer, you know that constants are always in all caps.

NogDog
06-12-2006, 12:47 PM
Closed thread, as it is a duplicate of this thread (http://www.webdeveloper.com/forum/showthread.php?t=109835).