Jump to content

rather stumped - extract() issue


chrisuk

Recommended Posts

In my system a user can upload a file when they make a new entry.

 

There is code that only allows the user to upload a .doc file, which works just fine.

 

HOWEVER - try as i may with temporary session variables in case they try to upload an invalid file, I could not for the life of me get the text entered by the user to a) start from the far left of the text box - always appeared in the middle - even when using trim() or b) get the temp variable to destroy on successful uploading (so that the temp value does not appear if they go to add anew entry).

 

As a crude fix I used a temporary table to store the value of the entered text - awful i know but its a temp solution.

 

However, when writing to the DB using this temp idea, if there is an error i get the following error in my scripts:

 

Warning: extract() [function.extract]: First argument should be an array in ./topbar.php on line 18

 

Im using extract to get the specific line in the DB for that user.

 

If i delete the 2 lines of code to write to the temp folder though, it works just fine...but means if there is an error the user has to type out their description again.

 

Here is the code for the .doc checking:

 

if  (!preg_match('/\\.(doc)$/i', $_FILES['uploadedfile']['name'])) {
	//$temp = "INSERT into temp VALUES ('','{$_SESSION['id']}','$summary')";
	//$tempresult = mysql_query($temp) or die ("error");
 	header( "Location: ../home.php?error_id=2" );
	exit;
}

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/43220-rather-stumped-extract-issue/
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.