Jump to content

limiting user uploads


paulhook

Recommended Posts

Hi,

I am trying to limit the amount of photo's a user can upload the code I wrote for my html.php page doesn't work because it always displays a submit button. I would like it to display either a plain text message or a submit button.

Disregard the fact that no values are being passed to my if test, my actual code is longer and passes the correct values so that the test works.

 

<tr>

<td colspan="2"><input type="submit" class="button" value="<?php

if ( $images_total < "3" ) {

echo "_UPLOAD_SUBMIT";

{

else {

 

echo "You have reached your upload limit";

}

 

{

}

?>" /></td>

</tr>

Link to comment
https://forums.phpfreaks.com/topic/191637-limiting-user-uploads/
Share on other sites

Well, first of all $images_total should be an integer, not a string. Adding the quotes make it a string so using the greater than or less than comparison operators won't work here.

 

<tr>
            <td colspan="2"><input type="submit" class="button" value="<?php
if ( $images_total < 3 ) {
   echo "_UPLOAD_SUBMIT";
{
else {

echo "You have reached your upload limit";
   }

   {
   }
   ?>" /></td>
         </tr>

Thanks for the reply,

the $images_total < 3 was more of a typo than a problem, my problem is that either test message is still a submit button, I have attached pics of both results. I would like to only display a submit button if the upload limit is not reached.

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.