Results 1 to 5 of 5

Thread: An easy upload script?

  1. #1
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default An easy upload script?

    I've poured over some books and websites hoping for a simple solution, but all of the scripts and ideas I've seen are simply too complicated. I'm hoping you guys can at least get me to the starting line of the right race so I can figure this thing out - I have deadlines and anxious clients and time is of the essence.

    The client is an artist and I have a CMS where he can go in and upload an image and a for that image. Let's say the form is on upload.php and the images are in the directories below it: imgs/gallery/ for the full images and imgs/gallery/t/ for the s. How do I get from point A to point B - from the upload form to those directories with the images? And to put an individual image from the file input to a different directory depending on if that input's name is "file" or "thumb"?

    Thanks for any help you can give me, I'm quite desperate at the moment - this project really needs to get done.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Does it have to be that way? Why not look into a photo gallery system.

    One like Gallery is great, and you can configure it to your needs, it also has themes and skins and lots of other things, including carts and download options. When you upload the large image it will automatically make a thumbnail, which is displayed on the gallery page(s) and when clicked shows the larger image.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Dec 2006
    Location
    http://andersmoen.com
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

  4. #4
    Join Date
    Dec 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink

    Hi,
    Got a working code from the link above
    I'm using this code for file upload....
    its fine with images but how can i upload other formats such as Microsoft Word or Exel file or any simple text file

    Can anyone help me ??

    <?php
    if (($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/png")
    || ($_FILES["file"]["type"] == "image/pjpeg")
    && ($_FILES["file"]["size"] < 20000))
    {
    if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if

    (file_exists("upload/" . $_FILES["file"]["name"]))
    {
    echo $_FILES["file"]["name"] . " already exists. ";
    }
    else
    {
    move_uploaded_file($_FILES["file"]["tmp_name"],
    "upload/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
    }
    }
    }
    else
    {
    echo "Invalid file";
    }
    ?>

    Thanks in advence ......

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Hello Shriniwas,

    There is no point in posting your same question in multiple threads. I've already made a reply to your question in another thread which you can find at

    http://www.dynamicdrive.com/forums/s...ad.php?t=26379

Bookmarks

Posting Permissions

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