Jump to content

uploading images


amin1982

Recommended Posts

Hey Guys,

 

Need some help please. I've recently taken over the admin of a site... I've had since to move the site to a new server as part of this. The code has been previously bene built buy an absolute genious! I'm having trouble getting my head around it.One of the problems I'm having is with the content management area. Images are needed to be loaded but at the moment nothing happens. the page simply refreshes. The full code to the page is over 800 lines! but i'll show you the relevant code for the image upload.

 

I havent modified the code in any way as it doesnt need to be changed.

 

The only thing that has change is the path to the webspace.

 

I think myself that the problems lie with

 

$uploaddir = '/var/www/uploads/';

 

and

 

if (move_uploaded_file($t, "/home/vhost/belugablues.com/html/images/$n"))

 

any suggestions on how to resolve this?

 


$photoLink = $_REQUEST['photoLink'];
$photoLink_name = $_REQUEST['photoLink_name'];

$photoLink1 = $_REQUEST['photoLink1'];
$photoLink1_name = $_REQUEST['photoLink1_name'];
$photoLink2 = $_REQUEST['photoLink2'];
$photoLink2_name = $_REQUEST['photoLink2_name'];
$photoLink3 = $_REQUEST['photoLink3'];
$photoLink3_name = $_REQUEST['photoLink3_name'];
$photoLink4 = $_REQUEST['photoLink4'];
$photoLink4_name = $_REQUEST['photoLink4_name'];
$photoLink5 = $_REQUEST['photoLink5'];
$photoLink5_name = $_REQUEST['photoLink5_name'];


$image = $_REQUEST['image'];
$image_name = $_REQUEST['image_name'];

$smallimage = $_REQUEST['smallimage'];
$smallimage_name = $_REQUEST['smallimage_name'];

$t=$_FILES['photoLink']['tmp_name'];
$n=$_FILES['photoLink']['name'];
$uploaddir = '/var/www/uploads/'; ////////////////////////////////////////////PROBLEM?
$uploadfile = $uploaddir . basename($_FILES['photoLink']['name']);

 


// ** Upload any images

if ($image_name != '') {
	upload_file($image,$image_name);
	$qry .= ",image='".$image_name."'";
}

if ($smallimage_name != '') {
	upload_file($smallimage,$smallimage_name);
	$qry .= ",smallimage='".$smallimage_name."'";
}

//if ($photoLink_name != '') {
if ($n != '') {
	//upload_file($photoLink,$photoLink_name);
	//upload_file($t, $n);
	//$qry .= ",photoLink='".$photoLink_name."'";

	if (move_uploaded_file($t, "/home/vhost/belugablues.com/html/images/$n")) { ///////////////////////////////////////PROBLEM?
		   echo "File is valid, and was successfully uploaded.\n";
	} else {
		   echo "Possible file upload attack!\n";
	}

	$qry .= ",photoLink='".$n."'";
}

if ($photoLink1_name != '') {
	upload_file($photoLink1,$photoLink1_name);
	$qry .= ",photoLink1='".$photoLink1_name."'";
}

if ($photoLink2_name != '') {
	upload_file($photoLink2,$photoLink2_name);
	$qry .= ",photoLink2='".$photoLink2_name."'";
}

if ($photoLink3_name != '') {
	upload_file($photoLink3,$photoLink3_name);
	$qry .= ",photoLink3='".$photoLink3_name."'";
}

if ($photoLink4_name != '') {
	upload_file($photoLink4,$photoLink4_name);
	$qry .= ",photoLink4='".$photoLink4_name."'";
}

if ($photoLink5_name != '') {
	upload_file($photoLink5,$photoLink5_name);
	$qry .= ",photoLink5='".$photoLink5_name."'";
}

Link to comment
https://forums.phpfreaks.com/topic/42708-uploading-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.