The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

can not create temporary image file

Discussion in 'General Discussion' started by Kumar m, Jun 13, 2014.

  1. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    here code :
    if (move_uploaded_file($_FILES['image']['tmp_name'], $filepath . $imagename1)) {
    echo "Image Uploaded Successfully !!!";
    } else {
    echo "Could not move the file.";
    }
    ....
    i tried code to ==> echo $_FILES['image']['tmp_name'] <==
    it gives like output ==> /tmp/phpSCFtf3 <==
    it doesnot have file name and dir name also.
    i set permissions for both tmp and storing dir images also 0777 permissions.
    anyone help me to get temporary file name for uploaded imagefile.
    Thanks in Advance....
     

    Attached Files:

  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    What part of your cPanel are you having an issue with exactly?
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    As InfoPro suggested, it looks like you might have an issue with your PHP scripting, as opposed to an issue with the cPanel/WHM software. You may get more user feedback on this type of question on a forum dedicated to discussions of PHP development or website development in general.

    Thank you.
     
  4. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    i cant realize the correct part. but i gave all permissions to folders(both tmp and images). it shows only dir. not a filename..
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Please ensure you upload an index file to the public_html directory so it loads in lieu of the directory index. Note that files should typically have 0644 permissions while directories beneath public_html should have 0755 permissions.

    Thank you.
     
  6. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    cPanelMichael i tried this. but it gives ==> /tmp/phpnphfSE <==
     
  7. Audiopro

    Audiopro Active Member

    Joined:
    Feb 15, 2014
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    The code
    Code:
    move_uploaded_file($_FILES['image']['tmp_name'], $filepath . $imagename1)
    
    is trying to move a file with the name of '/tmp/phpSCFtf3' to whatever '$filepath . $imagename1' is declared as.

    The filename you are trying to copy is $_FILES['image']['tmp_name'].
    The echoed value is '/tmp/phpnphfSE' and is not a file name.
    The problem lies where $_FILES['image']['tmp_name'] is declared in your script.
     
  8. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Audiopro, i used my coding in localhost(wampserver). ir's working fine. but in cpanel only like this output.
     
  9. Audiopro

    Audiopro Active Member

    Joined:
    Feb 15, 2014
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    In your example, the variable $_FILES['image']['tmp_name'] is not being assigned to the name of an image.
    If the same code has worked previously then I would suggest that your PHP script is not looking in the correct place for your images.
    How are you running a PHP script in CPanel?
     
  10. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    i using the PHP code in cpanel like upload.php. i that file have coding to do image filename, size, format and move the file via ajax form...
     
  11. Audiopro

    Audiopro Active Member

    Joined:
    Feb 15, 2014
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    I am assuming the PHP file is running on the server totally independent of cPanel, is this correct?
    What does the .PHP script do? - Loads an image, and saves a copy of it onto the server?
    Are you using GD library?
     
  12. Kumar m

    Kumar m Member

    Joined:
    Jun 13, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    am using GD library. my problem resolved thanks to all replies.
     
Loading...

Share This Page