Jump to content

Recommended Posts

Hey,

 

I have a problem when I try and update and upload an xls file. It appears that the file has uploaded but when you try and download it its the contents is the same as the old file. Just to make sure it was working i tried it with a .txt file and it updated perfectly. Here is the code that I'm using to upload the files:

 

$fileref=$_POST['updatefile'];
	$username=$_POST['username'];
	$password=$_POST['password'];

	if($_FILES['uploadfile']['name']!=""){
	$oldfile=$_POST['oldfile'];
	$deletefile="../uploads/".$oldfile;
	unlink($deletefile);
		$file=$_FILES['uploadfile']['name'];
		$target_path = "../uploads/";
		$target_path = $target_path . basename( $_FILES['uploadfile']['name']); 
		$message = NULL;
		move_uploaded_file($_FILES['uploadfile']['tmp_name'], $target_path);
		$message="The file ".  basename( $_FILES['uploadfile']['name'])." has been uploaded";

		require_once('../../dbconnect/dbconnect.php');
		$updatefile="UPDATE files SET username='$username', password='$password', filename='$file' WHERE refid='$fileref'";
		$fileupdate=mysql_query($updatefile);

 

Does anyone know why this might be happening? Might it be something to do with the server not the above code?

 

Any help with this would be very much appreciated.

 

Cheers

 

Rob

Link to comment
https://forums.phpfreaks.com/topic/63511-problem-uploading-updated-xls-files/
Share on other sites

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.