File upload problem

Hi everybody,

I have recently change to a new server, and have some problem with a script for uploading files.
Script is an old which I have updated with new php command, <? not accepted in new server.

Scripts shall upload picture to folder in server and write information to database

From form script I am saving my upload

In my php script I do

elseif($Mode==“EditMapProperty”):
$Map_name = $HTTP_POST_FILES[‘Map’][‘name’];
$Property=new Property($PropertyID);
$ReferenceNo=$Property->Get_ReferenceNo();
if($Map!=""): $DeleteMap=$Dir_MapProperty_Admin."".$Property->Get_Map(); @unlink($DeleteMap); endif;
if($Map_name==""):
$Map=$Old_Map;
else:
copy($HTTP_POST_FILES[‘Map’][‘tmp_name’],
$Dir_MapProperty_Admin."".$ReferenceNo."-".$Map_name);
$Map=$ReferenceNo."-".$Map_name;
endif;

$Property->EditMap($Map);

echo “<meta http-equiv=“refresh” content=“0;URL=$Redirect2?p=property_details&PropertyID=$PropertyID”>”;

Can any help if there are any PHP problem in this coding.

Kind Regards
Tom

There may be several reasons why your code is not working on new server. Try to turn on error reporting and see what error message you get. Besides deprecated short php opening tag <? (which I assume you’ve changed to full tag <?php ), there are several things that you need to check:

  • $Dir_MapProperty_Admin check if the path stored in this variable exists on your new server
  • check if the folder, where you write file, is writable by php
  • try to use $_FILES predefined varialbe instead of $HTTP_POST_FILES (this last one was deprecated)

p.s. Please do not post the same message to the forum multiple times.

Sponsor our Newsletter | Privacy Policy | Terms of Service