Jump to content

They Cant Support Scripts ? ! ? My god i need help !


Recommended Posts

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.

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>

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))

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.