SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Uploading the same image to two different folders

    Hi,

    I'm trying to upload an image to two different directories, one for the regular image and one for the thumbnail.

    It moves to the first directory just fine, but won't move it to the second.

    It won't even give me an error message other than the one I specified in the ELSE.

    PHP Code:
    if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadimage))
                {
                    if(
    move_uploaded_file($_FILES['photo']['tmp_name'], $uploadthumb))
                    {
                        
    //run my query to insert into db here
                        
    if(mysql_query($ins))
                        {
                            
    $status "<p class=\"successmsg\">Image was successfully uploaded.</p>";
                            
    $showform false;
                            
                            
    //GET Uploaded Image Size
                            
    list($width$height) = getimagesize($img_name);
                        }else
                            {
                                
    $status "<p class=\"successmsg\">Image was not uploaded. (sql)</p>";
                            }
                    }else
    //if thumb is not uploaded
                        
    {
                            
    $status "<p class=\"successmsg\">Image was not uploaded. (thumb)</p>";//It gives me this message
                        
    }
                } 
    Is this sort of thing even possible? I need it to go to the two different folders so I can resize them after they've been uploaded.

    Thanks for any help!
    No, I REALLY dislike having to use Joomla.

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Maybe try copying the file after uploading it the first time?

  3. #3
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    move_uploaded_file should semantically strike you as why you can't put it in 2 different folders.

    Maybe try copy();

  4. #4
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wonshikee View Post
    move_uploaded_file should semantically strike you as why you can't put it in 2 different folders.

    Maybe try copy();
    Thanks to both for the quick response.

    wonshikee - it doesn't really strike me so.

    I thought since it's a temp file that it would be accessible to use more than once. Eh, live and learn.
    No, I REALLY dislike having to use Joomla.

  5. #5
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wonshikee View Post
    move_uploaded_file should semantically strike you as why you can't put it in 2 different folders.

    Maybe try copy();

    Am late.
    Never be shy to ask silly Qs
    An answer is always better than none


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
  •