Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    hi there,

    i just got this script working.. http://www.w3schools.com/php/php_file_upload.asp

    its spot on. Only thing is the person uploading the image doesnt need to know where its being stored on my server. So is there a way of cutting that crap out and simply send them to a web page? Saying cheers matey

    i have two files
    uploadindex.html (this has the form on)
    upload_file (this is the one with all the php on...

    when a file is uploaded i get all this on a blank page...
    Upload: facebook.jpg
    Type: image/pjpeg
    Size: 12.791015625 Kb
    Stored in: /tmp/phpuGgQeO Upload: facebook.jpg
    Type: image/pjpeg
    Size: 12.791015625 Kb
    Temp file: /tmp/phpuGgQeO
    Stored in: upload/facebook.jpg

    I just want it to say cheers and redirect them or something like that..

    thanks again
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Well in asp it's a response redirect ...

    Put it before the part of the script that writes out all the info.

    I suspect php has a similar command as
    A matter of fact, I know there is

    Just google php redirect ... Should show you how to do it.

  4. #3
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    92 times
    To redirect in php you want to use the following snippet:

    PHP Code:
    die(header("Location: /upload-confirmation.php")); 
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)

  5. #4
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    Where should that be added within the code I've already got?
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  6. #5
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    92 times
    PHP Code:
    <?php
    $allowedExts 
    = array("jpg""jpeg""gif""png");
    $extension end(explode("."$_FILES["file"]["name"]));
    if (((
    $_FILES["file"]["type"] == "image/gif")
    || (
    $_FILES["file"]["type"] == "image/jpeg")
    || (
    $_FILES["file"]["type"] == "image/pjpeg"))
    && (
    $_FILES["file"]["size"] < 20000)
    && 
    in_array($extension$allowedExts))
      {
      if (
    $_FILES["file"]["error"] > 0)
        {
        echo 
    "Error: " $_FILES["file"]["error"] . "<br />";
        }
      else
        {
        die(
    header("Location: /upload-confirmation.php")); //Place it here
        
    echo "Upload: " $_FILES["file"]["name"] . "<br />";
        echo 
    "Type: " $_FILES["file"]["type"] . "<br />";
        echo 
    "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo 
    "Stored in: " $_FILES["file"]["tmp_name"];
        }
      }
    else
      {
      echo 
    "Invalid file";
      }
    ?>
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:53 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com