Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22
  1. #21
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    Right !
    I get it, Im trying to repeat this 7 times in 1 page so how would i go around doing that?

  2. #22
    Join Date
    Jul 2004
    Location
    California
    Posts
    8,725
    Tokens
    3,789
    Habbo
    HotelUser

    Latest Awards:

    Default

    I tried the above code and it didn't work. I fixed it and allowed for 7 uploads:
    PHP Code:
    <?php require('head.php');
    if(!isset(
    $_POST['submit']))
        {
            echo
    '<div align="center">
            Please Choose a file to upload...<br />
            The banner displaying here is: <br />
            <center><img src=\'http://hhgs.net/valuesbanners/banner1.gif\' width=\'312\' height=\'50\'>
            </center>
            To update the banner make sure the file name is <b> \'banner1.gif\'</b> <br />
            <form enctype="multipart/form-data" action="" method="POST">
            Choose images to upload:<br />
            <input name="uploadedfile1" type="file" /><br />
            <input name="uploadedfile2" type="file" /><br />
            <input name="uploadedfile3" type="file" /><br />
            <input name="uploadedfile4" type="file" /><br />
            <input name="uploadedfile5" type="file" /><br />
            <input name="uploadedfile6" type="file" /><br />
            <input name="uploadedfile7" type="file" /><br />
            <input name="submit" type="submit" value="Upload Files" />
            </form></div>'
    ;
        } else {
            for (
    $i=1$i<=7$i++)
                {
                    if(
    basename$_FILES['uploadedfile'.$i]['name']) == "banner{$i}.jpg" && basename$_FILES['uploadedfile'.$i]['name']) != "")
                        {
                            
    $target_path "uploads/";
                            
    $target_path $target_path basename$_FILES['uploadedfile'.$i]['name']); 
                            if(
    move_uploaded_file($_FILES['uploadedfile'.$i]['tmp_name'], $target_path))
                                {
                                    list(
    $w$h) = getimagesize($target_path);
                                    if(
    $w<=800 && $h<=900)
                                        {
                                            echo(
    'Your image URL:<br /><input type="text" size="50" value="http://www.hhgs.net/valuesbanners/'.$target_path.'" /><br /><br />');
                                        } else {
                                            
    unlink($target_path);
                                            echo(
    'Images must be the dimensions 800*900 or less!<br>');
                                        }
                                } else {
                                    echo 
    "There was an error uploading the image {$i}, please try again!";
                                }
                        } else {
                            echo 
    "The name of image {$i} must be banner{$i}.jpg!<br />";
                        }
                }
        }
    ?>
    Last edited by HotelUser; 24-11-2008 at 04:23 AM.
    I'm not crazy, ask my toaster.

Page 3 of 3 FirstFirst 123

Posting Permissions

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