Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2007
    Posts
    721
    Tokens
    0

    Default I have a problem!

    So I am trying to make somthing (upload form)

    I got it all working, everything. Just when it upload's it doesn't bring back the file uploaded.

    eg what it does here:



    Insted it brings back this:

    It's done! The file has been saved as: /home/cocchic/public_html/upload/upload/9912563351.jpg


    How can I bring it back with the URL of the image like this has done?

    thanks. + rep/

    edit: and bring back an image of it
    Last edited by God..; 27-10-2007 at 09:30 AM.

  2. #2
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    Just edit the line of code what displays

    saved as: /home/cocchic/public_html/upload/upload/9912563351.jpg

  3. #3
    Join Date
    Aug 2007
    Posts
    721
    Tokens
    0

    Default

    it has '/upload/'

    Code:
    <?php
    //Сheck that we have a file
    if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
      //Check if the file is JPEG image and it's size is less than 350Kb
      $filename = basename($_FILES['uploaded_file']['name']);
      $ext = substr($filename, strrpos($filename, '.') + 1);
      if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && 
        ($_FILES["uploaded_file"]["size"] < 350000)) {
        //Determine the path to which we want to save this file
          $newname = dirname(__FILE__).'/upload/'.$filename;
          //Check if the file with the same name is already exists on the server
          if (!file_exists($newname)) {
            //Attempt to move the uploaded file to it's new place
            if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
               echo "It's done! The file has been saved as: ".$newname;
            } else {
               echo "Error: A problem occurred during file upload!";
            }
          } else {
             echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists";
          }
      } else {
         echo "Error: Only .jpg images under 350Kb are accepted for upload";
      }
    } else {
     echo "Error: No file uploaded";
    }
    ?>
    then when I move it i get this:


    Warning: move_uploaded_file(/home/cocchic/public_html/uploadhttp://cocchin.com/upload/ad-money.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/cocchic/public_html/upload/upload.php on line 14

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php8kGbjE' to '/home/cocchic/public_html/uploadhttp://cocchin.com/upload/ad-money.jpg' in /home/cocchic/public_html/upload/upload.php on line 14
    Error: A problem occurred during file upload!
    Last edited by God..; 27-10-2007 at 09:58 AM.

  4. #4
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    One i used was



    and it worked fine

  5. #5
    Join Date
    Aug 2007
    Posts
    721
    Tokens
    0

    Default

    Works fine +rep

    edit:

    Forbidden

    You don't have permission to access /upload/upload/1193482975.jpg on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.39 Server at Port 80

    Now I am getting this
    Last edited by God..; 27-10-2007 at 10:16 AM.

  6. #6
    Join Date
    Sep 2005
    Posts
    5,253
    Tokens
    3,625

    Latest Awards:

    Default

    problem like you owe people money and refuse to pay up?

  7. #7
    Join Date
    Oct 2006
    Location
    West Midlands
    Posts
    463
    Tokens
    2,175

    Latest Awards:

    Default

    Quote Originally Posted by Galaxay View Post
    One i used was



    and it worked fine
    Removed copyright from original maker?

  8. #8
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    I didnt copy anyone i used some guide then edited it however the original can be found in tutorials thread I did copy the main from it then edited it

Posting Permissions

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