Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need people to be able to Upload Images to my website

    I'm new to coding and need help!

    I just need people to be able to upload an image or images to my site. I've found that I need to use a FileField Object but I'm not sure how to set this all up so it actually functions.

    Does anyone have a quick explaination or an example I could work from?? Any help would be greatly appreciated!

    Thanks so much!
    Kelly Jane

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This would require a php script. You need to first install a local webhost on your network. I would suggest Abyss Web Server. Then you need to download the php windows binaries and install them. You can get these from www.php.net . After you install those, you need to configure Abyss Web Server, then create your php script.

    Code:
    <?php
    
    $file = $_POST['file'];
    $to = "./uploads";
    
    $msg = "Your file, $file, was uploaded successfully to the directory $to!";
    $ermsg = "Your file, $file, could not be uploaded to the directory $to!";
    
    if (copy ($file, $to)){
      print("$msg");
    }else{
      print("$ermsg");
    }
    
    unlink ($file);
    
    ?>
    This is some code that may work for what you want. You do have to edit the variables, and in your form, name the file input, "file".

  • #4
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Any simpler way?

    Is there any simpler way? Such as creating a form with an action that will upload the file into a folder I create??

  • #5
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by KellyJane
    Is there any simpler way? Such as creating a form with an action that will upload the file into a folder I create??
    Nope. You could also get a free web server (good one at www.codes4u.com I think), and upload your files there. But in your form, your form, you would creat ethe form tags something like this:

    <form method="post" action="./*THE PHP FILE*.php">

    *FORM CODE HERE*

    </form>

    That is the only way to upload files. You must use a server side script such as php. You can get more information on the php coding language at http://www.php.net, and I great starter book that I recommend would be:

    PHP for the world wide web
    By Larry Ullman
    ISBN: 0-201-72787-0

    If your willing to spend $20 to learn it..

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This isnt entirely true, I believe you can use a form, and use the mailto: method, however this isnt really the best way to go compared to a server side script.

  • #7
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your help!


  •  

    Posting Permissions

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