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

Link to comment
Share on other sites

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

Link to comment
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.