Uploading photos........

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cheryl
    New Member
    • Nov 2006
    • 9

    Uploading photos........

    We are asked to create a website that can upload photos....Our website administrator must upload photos. His upoloaded photos must reflect on the users interface.. I dont know where and how to start with this module. can you help me to find codes in uploading photos?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Depends on whether you want to write all upload code yourself or use a free class available at phpclasses.org. Have a look at the Upload class
    Originally posted by upload class
    This class is meant to assist in the management of files uploaded via Web forms.

    It provides means to copy the uploaded files a separate folder. If the files are images in the GIF, PNG or JPEG format, it may also generate thumbnails by rescaling the uploaded images.
    a basic upload script.. You can also resize the uploaded image and create thumbnails with that image
    Ronald :cool:

    Comment

    • kamill
      New Member
      • Dec 2006
      • 71

      #3
      Yes .....this is simple..you can start with php function

      [PHP]bool move_uploaded_f ile ( string filename, string destination)[/PHP]

      This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

      If filename is not a valid upload file, then no action will occur, and move_uploaded_f ile() will return FALSE.

      Comment

      • cheryl
        New Member
        • Nov 2006
        • 9

        #4
        bool move_uploaded_f ile ( string filename, string destination)

        Where should i put this codes? can you recommend any website links that can help me with this problem?

        Comment

        • kamill
          New Member
          • Dec 2006
          • 71

          #5
          Sorry for late replly... i was busy.
          try with this code.
          [HTML]<form enctype="multip art/form-data" action="upload. php" method="POST">
          <input type="hidden" name="post" value="100000" />
          Choose a file to upload: <input name="uploadedf ile" type="file" /><br />
          <input type="submit" value="Upload File" />
          </form>[/HTML]

          [PHP]/
          $target_path = "uploads/"; //Where the file is going to be placed

          /* Add the original filename to our target path.
          Result is "uploads/filename.extens ion" */
          $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
          $_FILES['uploadedfile']['tmp_name'];

          $target_path = "uploads/";

          $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

          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!";
          }
          [/PHP]

          Comment

          Working...