so, after reading a bunch of stuff i'm still confused about tmp_name.

my code looks as follows:

if (is_uploaded_file($FILES['aimage']['tmp_name'])) {
$pic = $
FILES['aimage']['name'];
$array = explode (".",$pic);
$i = count($array);
$extension = strtolower($array[$i-1]);
$aimage = "$artist_id.$extension";
$move = move_uploaded_file($_FILES['aimage']['tmp_name'], "/new/images/artists/".$aimage);

when i test my code and attempt to upload a picture associated with the artist i recieve the following error:

Warning: move_uploaded_file(/new/images/artists/35.jpg): failed to open stream: No such file or directory in /home/prg/public_html/new/process.php on line 95

Warning: move_uploaded_file(): Unable to move '/var/tmp/php312Rvl' to '/new/images/artists/35.jpg' in /home/prg/public_html/new/process.php on line 95

now, i'm guessing it's because the web user doesn't have access to the /var/tmp folder because it appears the file isn't being created.

my question i guess is where/how do i declare that darn tmp folder in my code?

thanks much in advance!
justin

    invalid path.

    $move = move_uploaded_file($_FILES['aimage']['tmp_name'], "/new/images/artists/".$aimage);

    try change this to

    $move = move_uploaded_file($_FILES['aimage']['tmp_name'], $aimage);

      toxic, thanks so far when i submit i don't have an error yet i'm still not seeing the file being uploaded. how does it know where to upload the files then?

      i thought that is where the path should be set to put the files in.

        nevermind! i am blind. thank you so much for the help.

          good
          u have to create a folder
          "new/images/artists" inside where this php file is.

          remove the slash in "/new" to "new"

          here it is

          $move = move_uploaded_file($_FILES['aimage']['tmp_name'], "new/images/artists/".$aimage);
          

            right on, it works. thank you so much!!!!!!

              Write a Reply...