Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,680
    Thanks
    28
    Thanked 4 Times in 4 Posts

    I need a little help with this form !

    Hi - hope you can help me on this one !

    I am processing a form to upload an image
    which contains:


    PHP Code:
    <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

  • #2
    Regular Coder
    Join Date
    Sep 2005
    Posts
    394
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That is simply a notice warning you of an assumption php made. name is a constant. PHP needs to know it's a string, therefore put 's around your name.

    I.E.

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

    ~Phil~


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •