SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cant upload file

    hi!
    the file wotn be uploaded and this field wont enter into mysql database!!!

    PHP Code:
    <?php
    }
    function 
    process_step1()
    {
    $path "$fpath";
    $bgimage $_POST["UploadedFile_name"];
    $blmargin $_POST["blmargin"]; 
    $btmargin $_POST["btmargin"]; 
    $bmwidth $_POST["bmwidth"]; 
    $bmheight $_POST["bmheight"]; 
    $bgimage $_POST["bgimage"]; 
    $input0 $_POST["input0"]; 
    $bff $_POST["bff"]; 
    $input1 $_POST["input1"]; 
    $bfs $_POST["bfs"]; 
    if((
    $_POST["blmargin"] !="") && ($_POST["btmargin"] !="")) 
      {    
    $ret "INSERT INTO wt_style_design_body VALUES('', '$blmargin', '$btmargin', '$bmwidth', '$bmheight', '$bgimage', '$input0', '$bff', '$input1', '$bfs')";
          
    $resultat mysql_query($ret);
        
    mysql_close($connect);
    echo 
    "<font color='#ff0000'>Data sucessfully stored!</font><br>";
    } else {
    echo 
    "<font color='#ff0000'>Inserting data problems!</font><br>";  
    }
        if(
    $_POST["UploadedFile"] != none )
        {
            if (
    copy($UploadedFile $path/UploadedFile_name )) {
                print 
    "<font color='#ff0000'>File uploaded sucessfully!</font><br>";
            }else{
                print 
    "<font color='#ff0000'>Cant upload selected file!</font><br>";
            } 
            
    unlink($UploadedFile);
        }else{
            print 
    "No file selected.<br>";
        }

    }
    other stuff works perfectly!
    any suggestion!
    thanx

  2. #2
    SitePoint Zealot themissingelf's Avatar
    Join Date
    Nov 2001
    Location
    UK
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $bgimage $_POST["UploadedFile_name"]; 
    $bgimage $_POST["bgimage"]; 
    Could it be the $bgimage variable being used twice?

  3. #3
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    still wont work

    the file wont upload and the uploaded file name wont go to database???
    the other stuff work perfectly just the uploaded file name wont enter!!!!
    the mysql connection is ok and the path to upload directory is into config!
    what is wrong here???
    PHP Code:
    <?php
    }
    function 
    process_step1()
    {
    $blmargin $_POST["blmargin"]; 
    $btmargin $_POST["btmargin"]; 
    $bmwidth $_POST["bmwidth"]; 
    $bmheight $_POST["bmheight"]; 
    $UploadedFile $_POST["UploadedFile"]; 
    $input0 $_POST["input0"]; 
    $bff $_POST["bff"]; 
    $input1 $_POST["input1"]; 
    $bfs $_POST["bfs"]; 
    if((
    $_POST["blmargin"] !="") && ($_POST["btmargin"] !="")) 
      {    
    $ret "INSERT INTO wt_style_design_body VALUES('', '$blmargin', '$btmargin', '$bmwidth', '$bmheight', '$UploadedFile', '$input0', '$bff', '$input1', '$bfs')";
          
    $resultat mysql_query($ret);
        
    mysql_close($connect);
    echo 
    "<font color='#ff0000'>Data sucessfully stored!</font><br>";
    } else {
    echo 
    "<font color='#ff0000'>Inserting data problems!</font><br>";  
    }
        if(
    $_POST["UploadedFile"] != none )
        {
            if(
    copy$UploadedFile $path/UploadedFile_name )) {
                print 
    "<font color='#ff0000'>File uploaded sucessfully!</font><br>";
            }else{
                print 
    "<font color='#ff0000'>Cant upload selected file!</font><br>";
            } 
            
    unlink($bgimage);
        }else{
            print 
    "No file selected.<br>";
        }

    }
    ?>
    suggestions?
    thanx in advance

  4. #4

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In order to access the uploaded file you need to use the $_FILES array instead of $_POST.

    More Information

  5. #5
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still the file name wont be registered into mysql and the file wont be uploaded to the defined dir!!!
    the rest is ok!
    PHP Code:
    <?php
    }
    function 
    process_step1()
    {
    $blmargin $_POST["blmargin"]; 
    $btmargin $_POST["btmargin"]; 
    $bmwidth $_POST["bmwidth"]; 
    $bmheight $_POST["bmheight"];  
    $uploaddir '/public/';
    $uploadfile $uploaddir $_FILES['userfile']['name'];
    $input0 $_POST["input0"]; 
    $bff $_POST["bff"]; 
    $input1 $_POST["input1"]; 
    $bfs $_POST["bfs"]; 
    if((
    $_POST["blmargin"] !="") && ($_POST["btmargin"] !="")) 
      {    
    $ret "INSERT INTO wt_style_design_body VALUES('', '$blmargin', '$btmargin', '$bmwidth', '$bmheight', '$uploadfile', '$input0', '$bff', '$input1', '$bfs')";
          
    $resultat mysql_query($ret);
        
    mysql_close($connect);
    echo 
    "<font color='#ff0000'>Data sucessfully stored!</font><br>";
    } else {
    echo 
    "<font color='#ff0000'>Inserting data problems!</font><br>";  
    }
    print 
    "<pre>";
    if (
    move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
       print 
    "File is valid, and was successfully uploaded. ";
       print 
    "Here's some more debugging info:\n";
       
    print_r($_FILES);
    } else {
       print 
    "Possible file upload attack!  Here's some debugging info:\n";
       
    print_r($_FILES);
    }
    print 
    "</pre>";
    }
    ?>
    suggestions?
    thanx in advance!

  6. #6
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    problem solved!!!!
    thanx a lot


Bookmarks

Posting Permissions

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