Results 1 to 4 of 4

Thread: User Image Upload

  1. #1
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default User Image Upload

    I was wondering how I could let the user upload a an image to my ftp server, I was thinking of using ftp functions, but it didn't work.

    I would have a text field on the previous page with the file src in it.
    Something like
    Code:
    $src = $_POST['image_src'];
    then I want to be able to upload it to the server.

    Thanks in advance,
    Mike
    - Mike

  2. #2
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    is the folder it is in set to chmod 777?

    here is a script I have for a forum board I am creating, it is for uploading an avatar... you can pick out the bits you need.

    Code:
    if ($_POST['remoteavatar'] || $_FILES['uploadavatar']['tmp_name']) {
    
    
    $message=$_POST['remoteavatar'];
    
    if($avatar_upload_allowed=="Yes") {
    
    if($_FILES['uploadavatar']['tmp_name']) {
    
    $uploadin=1;
    
    $folder = "./uploads/";
    $temporary = $_FILES['uploadavatar']['tmp_name'];

  3. #3
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    or try looking at php image gallery scripts

  4. #4
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The form
    Code:
    <form enctype="multipart/form-data" method="post" action="uploading.php" 
    		name="form" id="form">
    <input name="pic" id="pic" type="file">
    </form>
    And uploading:
    PHP Code:
    if ($_FILES['pic']['size']) {
        if (!
    file_exists("$imagepath")) mkdir("$imagepath"755);
        
    move_uploaded_file($_FILES['pic']['tmp_name'], "$imagepath/"$_FILES['pic']['name']);


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
  •