Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Location
    Brisbane, Australia
    Posts
    796
    Tokens
    0

    Default Whats rong with this

    Okay look at title
    PHP Code:
    <?php
    ########## If add download was hit ##########
    else if ($_GET['act'] == 'downloads') {
        
        
    // If form sent
        
    if ($_POST['add']) {
            
    $title mysql_real_escape_string($_POST['title']);
            
    $description mysql_real_escape_string($_POST['description']);
            
    $date date('n/j/y');
            
    $imgUploadPath $path.basename(''.$title.'_'.$_FILES['img']['name'].'');
            
    $fileUploadPath $filePath.basename("".$_FILES['files']['name']."");
            
            
    // Check fields
            
    if (!$title || !$date) { echo '<meta http-equiv="refresh" content="2;URL='.$_SERVER['PHP_SELF'].'?act=downloads" /> <span style="color: #FF0000">Please fill in all fields.</span>'; } 
            
            
    // Move file
            
    else if (!move_uploaded_file($_FILES['img']['tmp_name'], $imgUploadPath)) { echo '<meta http-equiv="refresh" content="2;URL='.$_SERVER['PHP_SELF'].'?act=downloads" /> <span style="color: #FF0000">Error uploading the preview image</span>'; echo $path.basename(''.$title.'_'.$_FILES['img']['name'].'');} 
            
            else if (!
    move_uploaded_file($_FILES['files']['tmp_name'], fileUploadPath)) { echo '<meta http-equiv="refresh" content="2;URL='.$_SERVER['PHP_SELF'].'?act=downloads" /> <span style="color: #FF0000">Error uploading the file</span>'; } 
            
            else {
            
    $insert mysql_query("INSERT INTO `downloads` (id, title, description, url, img, date) VALUES ('', '$title', '$description', '$filePath".$_FILES['name']['files']."', '$path".$title."_".$_FILES['name']['img']."', '$date')") or die ("Error Inserting Download! \n<br />\n" .mysql_error());
            
            echo 
    '<meta http-equiv="refresh" content="2;URL=index.php" /> The download, <b>'.$title.'</b> has been added.';
            }
        }
        
        
        
    // If form not sent
        
    if (!$_POST['add']) { ?>
        
                <!-- Add Download Form -->
                <form method="post" action="<?php echo $_SERVER['PHP_SELF'?>?act=downloads" title="add_news">
                    <table width="400" align="center">
                        <tr>
                            <td width="72">Title:</td>
                            <td width="316"><input type="text" name="title" /></td>
                        </tr>
                        <tr>
                            <td>Description:</td>
                            <td><input name="description" type="text" maxlength="200" /></td>
                        </tr>
                        <tr>
                            <td>Image:</td>
                            <td><input type="file" name="img" /></td>
                        </tr>
                        <tr>
                            <td>File:</td>
                            <td><input type="file" name="files" /></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="submit" name="add" value="Add" /></td>
                        </tr>
                    </table>
                </form>
            <!-- /Add Download Form -->
            
        <? }
    }
    ?>
    Thanks,
    Chris
    Free Image Uploading

    __________________


    [/url]

    [/FONT]

  2. #2
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    second line,
    else if ($_GET['act'] == 'downloads') {

    why have u got an else there

    if ($_GET['act'] == 'downloads') {


    Also post any error messages u get to help,
    Last edited by Eric30; 22-06-2007 at 10:24 AM.

  3. #3
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    3rd line actually ;]
    Looking for a good desiner to design a social networking template.

    PM me.

  4. #4
    Join Date
    May 2007
    Location
    Brisbane, Australia
    Posts
    796
    Tokens
    0

    Default

    it wont show up now & Evan with the else in front it goes Fatal Error...


    http://www.hmit.com.au/u.php
    Thanks,
    Chris
    Free Image Uploading

    __________________


    [/url]

    [/FONT]

Posting Permissions

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