...

View Full Version : passing variable not working correctly



JimM
02-25-2008, 08:37 AM
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.



define($ParmData[$i]['parm_name'], $ParmData[$i]['parm_val']);

parm_name = imagesize
parm_val = 600 * 600
(both from mysql text fields)



$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; ?>">



echo (int) (imagesize);

Thanks
Jim

Inigoesdr
02-25-2008, 02:53 PM
Where is the code you're trying to use to echo a multiplied integer?

JimM
02-26-2008, 07:07 AM
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
// $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; ?>">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum