GreenSmurf Posted February 2, 2010 Share Posted February 2, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/190724-upload-script-i-think-i-have-narrow-the-error-down-to-this-part/ Share on other sites More sharing options...
RussellReal Posted February 2, 2010 Share Posted February 2, 2010 $savePath = trim($leadon,'/').'/'.trim($_FILES['file']['name']); Quote Link to comment https://forums.phpfreaks.com/topic/190724-upload-script-i-think-i-have-narrow-the-error-down-to-this-part/#findComment-1005795 Share on other sites More sharing options...
GreenSmurf Posted February 8, 2010 Author Share Posted February 8, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/190724-upload-script-i-think-i-have-narrow-the-error-down-to-this-part/#findComment-1008976 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.