uploading files using php and apache

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mollymalone
    New Member
    • Mar 2007
    • 2

    uploading files using php and apache

    im trying to upload a file using php and apache and i get a blank screen when i submit the file. the php and apache are configured correct as i can open a test php file and as the file i want to upload is small there shouldnt be any problem with the size.can anybody help me?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    What is the script you upload to supposed to output?

    Comment

    • mollymalone
      New Member
      • Mar 2007
      • 2

      #3
      Originally posted by Banfa
      What is the script you upload to supposed to output?
      this is the code for the submit file:

      <html>
      <head>
      <title>file upload</title>
      </head>

      <body>
      <h2>upload</h2>
      <FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.ph p" METHOD = "POST">
      <INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_S IZE" VALUE = "20000">

      Filename:
      <INPUT NAME = "userfile" TYPE = "file">
      <BR>
      <BR>
      <INPUT TYPE = "submit" VALUE = "send">
      </FORM>
      </BODY>
      </HTML>


      this is the php upload file:

      <?
      if ($userfile == "none"){
      echo "No file specified";
      exit;
      }
      if (move_uploaded_ file($userfile, "\\uploads\\".$ userfile_name)) {
      echo "your file has been uploaded";
      }else{
      echo "could not upload file";
      }
      ?>

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        When you upload, your file will be located in $_FILES['userfile'] not $userfile.

        Originally posted by mollymalone
        this is the code for the submit file:

        <html>
        <head>
        <title>file upload</title>
        </head>

        <body>
        <h2>upload</h2>
        <FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.ph p" METHOD = "POST">
        <INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_S IZE" VALUE = "20000">

        Filename:
        <INPUT NAME = "userfile" TYPE = "file">
        <BR>
        <BR>
        <INPUT TYPE = "submit" VALUE = "send">
        </FORM>
        </BODY>
        </HTML>


        this is the php upload file:

        <?
        if ($userfile == "none"){
        echo "No file specified";
        exit;
        }
        if (move_uploaded_ file($userfile, "\\uploads\\".$ userfile_name)) {
        echo "your file has been uploaded";
        }else{
        echo "could not upload file";
        }
        ?>

        Comment

        Working...