Ok, so I am having to do some work for a client that is hosted on a Windoze server with GoDaddy. Out of the slew of functions disabled by them, the functions I am using are not disabled.

Here is the problem:

A file can be uploaded to the temp directory, but not moved. I can view the full path to the temp dir and the perm dir and they are correct.

I get the error that I can't move the uploaded file using the code below. Any suggestions as to what could be wrong would rock cause this has been an issue for days now. GoDaddy is no help, mainly because they are all sales people.

// echo $pic['tmp_name'];
// outputs d:\temp\12345.tmp

$des = $_SERVER['DOCUMENT_ROOT']."\images\\";
  echo $des.$pic['name'];
  // outputs d:\hosting\username\images\image.jpg	
	if(is_uploaded_file($pic['tmp_name'])){
	 if(move_uploaded_file($pic['tmp_name'], $des.$pic['name'])){
	   echo "<br>Image was uploaded<br>";
	  } else {
	   $err[] = "Could not move the uploaded image.";
	  }
	} else {
	 $err[] = "Could not upload the image.";
	}

TIA.

    are you able to grab the contents of $pic['tmp_name'] using file_get_contents or something and then just use fopen to create a new file where you want it?

      That is a great solution that I never thought of.

      The only problem is that GoDaddy has fopen, fread, fwrite and several other functions disabled.

        how about copy() and rename()? Thats about the last idea I have, it could come to the point where you tell them its not possible with GoDaddy and they'll have to switch hosts.

          Here's what's disabled:

          getmyinode, getopt, getrusage, extension_loaded, dl, mysql_pconnect, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, pfsockopen, mysql_list_dbs, mysql_stat, ini_get, ini_get_all, ini_alter, ini_set, get_current_user, get_defined_constants, get_include_path, php_ini_scanned_files, php_uname, phpcredits, restore_include_path, set_include_path, set_time_limit, version_compare, zend_version, getmypid, getmyuid, getmygid, assert_options, assert, fopen, fwrite, fread, file, fpassthru, file, mail, opendir, readdir, closedir

            if(copy($pic['tmp_name'], $des)){
            	 echo 'Copy worked.';
            	} else {
            	 echo 'Copy failed.';
            	 if(rename($pic['tmp_name'], $des)){
            	   echo 'Rename worked.';
            	  } else {
            	   echo 'Rename failed.';
            	  }
            	}

            Copy failed.
            Rename failed.

            fook!

              So, should I concluded that it isn't possible?

                yeah without fopen or any of the copy/move functions working, theres really no way to get it out of the temp dir that I can think of. Quite a shame its so tight on the godaddy servers. For some reason a while ago I remember fopen and fwrite working on a linux godaddy site, but if they're on windows not much can be done about that.
                Too bad they are oversecure. With open_basedir properly configured fopen etc is not much of a threat.

                  Write a Reply...