Jump to content

Upload script. I think I have narrow the error down to this part.


GreenSmurf

Recommended Posts

Allow uploads is true and I have been able to verify that the logic is working properly but the uploading process itself is not.

A possible culprit is the variable $leadon which is the directory value for the person logged into their account. The directory is correct and is based on their name and unique member id. For example, my test account has the directory set to User_Name43.

if($allowuploads && $_FILES['file']) {
$upload = true;
if(!$overwrite) {
	if(file_exists($leadon.$_FILES['file']['name'])) {
		$upload = false;
	}
}

if($upload) {
	move_uploaded_file($_FILES['file']['tmp_name'], $leadon . $_FILES['file']['name']);
}
}

 

Any hints at what appears to be wrong would be most appreciated. If you need to see more code I can throw it up but I did not want to burden anyone person's eyes with all the code.

 

-Smurf

Found the error. It was a check just above the code I provided. Thank you RussellReal for your tip. It made me think about what information was being passed. So, I echoed the information being passed and saw that its was doubling up on the variable $leadon and that made me think what could be causing it. Turns out that this code:

if($dirok) {
	 $leadon = $leadon.$_REQUEST['dir'];
}

 

Was supposed to be this:

 

if($dirok) {
	 $leadon = $_REQUEST['dir'];
}

 

Thank you for your help. Simple fix for a simple problem.

 

-GS

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.