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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts

    passing variable not working correctly

    Having some problems working with variables below.

    $max_size2 works fine but $max_size1 doesn't work at all (get a file size error when I try and upload a file). I've printed out $max_size1 and it prints out 600 * 600. Also gave a try at using (int) thinking it might do the trick, but it doesn't work echo's out 600. I could set the parm_val at 360000 but I have to set it up for folks to enter 600 * 600 (as in 600 width x 600 height) as max rather then 360000 for file size.

    I'm not sure why $max_size1 doesn't work so if some one wouldn't mind explaining that would be appreciated and is there a solution? (other then going to two fields and multiplying prior to using)

    Yes I have some difficult folks I work with and I know that would allow them to upload a file 800x400 all I'm really worried about right now is actual file size but head-shed wants them to be able to enter as 600 * 600. The parm table is a name value pair table and I really don't want to change single size parm into two size parms one for width and one for height at this time, just looking for a quick solution.

    PHP Code:
    define($ParmData[$i]['parm_name'], $ParmData[$i]['parm_val']); 
    parm_name = imagesize
    parm_val = 600 * 600
    (both from mysql text fields)

    PHP Code:
    $max_size1 = imagesize;

    $max_size2 = 600*600;     // This line works fine

    <form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <input name="tmp_filedel" type="hidden" value= "" id="tmp_filedel" />
        <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size?>">
    PHP Code:
    echo (int) (imagesize); 
    Thanks
    Jim
    Last edited by JimM; 02-25-2008 at 08:40 AM.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Where is the code you're trying to use to echo a multiplied integer?

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    Where is the code you're trying to use to echo a multiplied integer?
    I had this in the code, pulled it out for example. I did change hidden input in test to use either $max_size1 or $max_size2 vice $max_size
    PHP Code:
    <?php
    //    $max_size1 = imagesize;
    //    print "<pre>Org value-----> $max_size1</pre>";           (returns 600 * 600, but returns error noted)
    //    $max_size2 = (int) (imagesize);
    //    print "<pre>value-----> $max_size2</pre>";        (returns 600)
    //    echo (int) (600 * 600);                                          (returns 600 * 600)
    //    echo (int) (370000);


    $max_size2 600*600;     // This line works fine
    ?>

    <form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <input name="tmp_filedel" type="hidden" value= "" id="tmp_filedel" />
        <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size?>">
    Last edited by JimM; 02-26-2008 at 07:21 AM.


  •  

    Posting Permissions

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