file upload problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jmlin84@gmail.com

    #1

    file upload problems

    I'm using the code:

    if(move_uploade d_file($_FILES['uploadedfile']['tmp_name'],
    $target_path)) {
    echo "The file ". basename( $_FILES['uploadedfile']['name']). "
    has been uploaded";
    } else{
    echo "There was an error uploading the file, please try again!";
    }

    but move_uploaded_f ile keeps returning false. I checked the $_FILES
    array and all the values are correct and it seems as if the file is on
    ther server. I just can't move it. Any ideas anyone?

    I'm using a form to uploada the picture.

    <form enctype="multip art/form-data" action="./uploadUserPhoto .php"
    method="POST">
    <input type="hidden" name="MAX_FILE_ SIZE" value="100000" />
    Choose a picture to upload:
    <input name="uploadedf ile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>

    thanks,

    James

  • chotiwallah

    #2
    Re: file upload problems


    jmli...@gmail.c om wrote:[color=blue]
    > I'm using the code:
    >
    > if(move_uploade d_file($_FILES['uploadedfile']['tmp_name'],
    > $target_path)) {
    > echo "The file ". basename( $_FILES['uploadedfile']['name']). "
    > has been uploaded";
    > } else{
    > echo "There was an error uploading the file, please try again!";
    > }
    >
    > but move_uploaded_f ile keeps returning false. I checked the $_FILES
    > array and all the values are correct and it seems as if the file is on
    > ther server. I just can't move it. Any ideas anyone?
    >
    > I'm using a form to uploada the picture.
    >
    > <form enctype="multip art/form-data" action="./uploadUserPhoto .php"
    > method="POST">
    > <input type="hidden" name="MAX_FILE_ SIZE" value="100000" />
    > Choose a picture to upload:
    > <input name="uploadedf ile" type="file" /><br />
    > <input type="submit" value="Upload File" />
    > </form>
    >
    > thanks,
    >
    > James[/color]

    no write permission in the dir you move the file to?

    micha

    Comment

    • Fran García

      #3
      Re: file upload problems

      Maybe your file has a size higher than the maxim size allowed for the server

      chotiwallah wrote:[color=blue]
      > jmli...@gmail.c om wrote:
      >[color=green]
      >>I'm using the code:
      >>
      >>if(move_uploa ded_file($_FILE S['uploadedfile']['tmp_name'],
      >>$target_path) ) {
      >> echo "The file ". basename( $_FILES['uploadedfile']['name']). "
      >>has been uploaded";
      >>} else{
      >> echo "There was an error uploading the file, please try again!";
      >>}
      >>
      >>but move_uploaded_f ile keeps returning false. I checked the $_FILES
      >>array and all the values are correct and it seems as if the file is on
      >>ther server. I just can't move it. Any ideas anyone?
      >>
      >>I'm using a form to uploada the picture.
      >>
      >><form enctype="multip art/form-data" action="./uploadUserPhoto .php"
      >>method="POST" >
      >><input type="hidden" name="MAX_FILE_ SIZE" value="100000" />
      >>Choose a picture to upload:
      >><input name="uploadedf ile" type="file" /><br />
      >><input type="submit" value="Upload File" />
      >></form>
      >>
      >>thanks,
      >>
      >>James[/color]
      >
      >
      > no write permission in the dir you move the file to?
      >
      > micha
      >[/color]

      Comment

      • Jimmy Reds

        #4
        Re: file upload problems

        Hi,

        If you are using PHP 4.2.0 or above then you may find that the
        following page helps :


        I was getting errors in one of my scripts then I stumbled across that
        page, found out what the error actually was and was able to fix it.

        Hope this helps,

        Jimmy.

        Comment

        Working...