Accurax Posted March 26, 2007 Share Posted March 26, 2007 Ive just sorted the hosting out for my new site, and uploaded it throughout the day... sorting the database out and crushing errors with my mighty notepad. All was going well untill i came to test my image upload facility. 6 hours and 12 phonecalls to www.fasthosts.co.uk technical support.... and i'm ready to seriously hurt the next poor s.o.b who looks at me funny I have been told ....... "we dont have a tmp directory for php uploads" ........ "I cant help we dont support scripting and its not our fault your codes wrong" and my favorite ... "whats php?" I'm pretty sure its a configuration error, and i think i need to find the tmp directory that the image is uploaded to before i move it. Ok, guys i need help; I've even tried creating my own tmp file..... but that didnt work (not that i thought it would) heres my script ; <?php session_start(); include("../private.inc"); if ( $_SESSION['login'] != "true" ) { header("location: ../registration.php"); } else { $connection=mysql_connect($host, $user, $passwd) or die ("Could not connect !"); $db = mysql_select_db($database, $connection) or die ("Could not connect to Database"); //Process the large size image **************** $username = $_SESSION['username']; if (($_FILES['filename']['type']!="image/jpeg") && ($_FILES['filename']['type']!="image/pjpeg") && ($_FILES['filename']['type']!="image/gif")) { echo "Sorry you must upload only files of the type .jpg .jpeg or .gif, Click <a href='../picturemanager.php'>Here</a> to try again"; } else { $connection = mysql_connect($host, $user, $passwd) or die ("Could not connect !"); $db = mysql_select_db($database, $connection) or die ("Could not connect to Database"); $query = "SELECT picture1 FROM pictures WHERE user_name='$username'"; $exist = mysql_query($query) or die ("could not Select Picture."); preg_match('/\.\w{3,4}$/', $_FILES['filename']['name'], $matches); $new_filename = $_SESSION['username']."1".$matches[0]; $filepath = "member_pics/full_size/".$new_filename; if (file_exists($filepath)) { unlink("member_pics/full_size/".$new_filename); } $source = "member_pics/full_size/".$new_filename; move_uploaded_file($_FILES['filename']['name'], $source); // move the file $query = "UPDATE pictures SET picture1 = '$filepath' WHERE user_name='{$_SESSION['username']}'"; $result = mysql_query($query) or die ("could not add picture."); } } You shuld be able to see what this scripts trying (and failing) to do..... upload the file... move it to the directory i want to keep it in, check the file doesnt allready exist, delete if it does, and insert the path in my database. Can anyone help me with this, im going mad .... or , has anyone got experiance of this problem with Fasthosts, that can shed some light? I really appreciate any assistance on this thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/ Share on other sites More sharing options...
cmgmyr Posted March 26, 2007 Share Posted March 26, 2007 sounds like you need to find a new host come on they don't even know what PHP is? haha Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/#findComment-215429 Share on other sites More sharing options...
Accurax Posted March 26, 2007 Author Share Posted March 26, 2007 Heres a script that they ahve told me works....... but i cant see why <?php // Where the file is going to be placed $target_path = "\\IIS686\domains\a\adproperties.co.uk\user\htdocs\phpupload"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); // This is how we will get the temporary file... $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { header( "Location: http://www.adproperties.co.uk/"); } else{ header( "Location: http://www.adproperties.co.uk/"); } ?> <html> <head> <title>Upload status</title> <body bgcolor="A9A9A9"> </body> </head> </html> Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/#findComment-215434 Share on other sites More sharing options...
anthonydamasco Posted March 26, 2007 Share Posted March 26, 2007 I had alot of similar problems a few years ago. Get a new host and b4 you pay, call a sales rep and make sure they have the latest php, mysql and all that Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/#findComment-215461 Share on other sites More sharing options...
calabiyau Posted March 26, 2007 Share Posted March 26, 2007 The difference between the script they gave you and the one you provided is in the move_uploaded_file function. The first parameter has to be temp_name and you have name. I think if you change that to what they have shown you, it should work. This is what I use: move_uploaded_file($_FILES['upload']['tmp_name'],$destination_path)) Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/#findComment-215465 Share on other sites More sharing options...
Accurax Posted March 26, 2007 Author Share Posted March 26, 2007 tried that aswell.... been on the phone to them again (24hr tech support at least) and theyve escalated my ticket (after i threatened to cancel) and now they think it may be a server error. Calling it a night.... we shall see what the morrow brings... will keep u updated guys, and thanks for the help accura Quote Link to comment https://forums.phpfreaks.com/topic/44357-they-cant-support-scripts-my-god-i-need-help/#findComment-215485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.