I am having problem with move_uploaded_file.
Here is what I am trying to do.
upload a image file to a temporary folder on the server, which I called "temp". (code working fine) I need to do this in order to view a preview of the image.
rename the image file I just uploaded to some meaningful name. (code working fine)
move this renamed file to the new location on the server (This is the problem)
This is the code I am using
if(mysql_result($temp_result, 0, "photo") != 0){
$photo = mysql_result($temp_result, 0, "photo");
if($photo == 2){
$temp = 'temp_iamge.gif';
}else{
$temp = 'temp_image.jpg';
}
$file_name = ereg_replace("temp_image", $co_no, $temp);
if(move_uploaded_file('../images/temp/$temp', '../images/tab1/$file_name')){
//do something
}else{
//do something else
}
}
'../images/temp/' is the original location, whereas '../images/tab1/' is the new location.
The original file name is $temp, and the renamed one is $file_name.
Please someone help me!!!