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 3 of 3

Thread: Uploads

  1. #1
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    Wondering if someone could lend a hand.

    I need a small script that will allow me to upload images to the server without using ftp. i currently use jacks formmail which is too bulky for this.

    i just want a script that will allow jpg's and limit them to 100k and when the image is uploaded it woul print on the screen the url to the image which would be

    http://hostedpics.neonsonline.com/sigs/$imagename

    can anyone help out??

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    http://www.webdesignforums.net/thread1873.html is a tutorial here on PHP file uploading.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Member
    Join Date
    Jan 2003
    Location
    Moscow City
    Posts
    32
    Member #
    468
    The perfect solution

    upload.php

    PHP Code:
    <?
    //file_upload.php
    $archive_dir "./docs";
    function 
    upload_form() {
       global 
    $PHP_SELF;
    ?>
    <FORM METHOD="POST" ENCTYPE="MULTIPART/FORM-DATA" 
       ACTION="<? echo $PHP_SELF ?>">
       <INPUT TYPE="HIDDEN" NAME="action" VALUE="upload">
       Upload file!
       <INPUT TYPE="FILE" NAME="userfile">
       <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="upload">
    </FORM>
    <?
    }

    function 
    upload_file() {
       global 
    $userfile$userfile_name$userfile_size
             
    $userfile_type$archive_dir$WINDIR;

       if(isset(
    $WINDIR)) $userfile str_replace("\\\\","\\"$userfile);
       
       
    $filename basename($userfile_name);
       
       if(
    $userfile_size <= 0) die ("$filename is empty.");

       if(!@
    copy($userfile"$archive_dir/$filename"))
          die(
    "Can't copy $userfile_name to $filename.");
       
       if(!isset(
    $WINDIR) && !@unlink($userfile))
          die (
    "Can't delete the file $userfile_name.");

       echo 
    "$filename has been successfully uploaded.<BR>";
       echo 
    "Filesize: " number_format($userfile_size) . "<BR>";
       echo 
    "Filetype: $userfile_type<BR>";
    }
    ?>
    <HTML>
    <HEAD><TITLE>FILE UPLOAD</TITLE></HEAD>
    <BODY>
    <?
    if($action == 'upload'upload_file();
    else 
    upload_form();
    ?>
    </BODY>
    </HTML>
    Want a dynamic site with nice graphics? Solutions for the new age. Marco Tech
    vBulletin skins | Button sets | Free Photoshop addons | Web templates | PHP


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 12:49 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com