GarryOne Posted May 27, 2011 Share Posted May 27, 2011 where is the problem? http://pastebin.com/Smw92nd5 I'm looking for the folder where the uploaded file should be but it doesn't exist, it seems that the condition "if($ext == $need)" is ignored Quote Link to comment https://forums.phpfreaks.com/topic/237630-php-upload-file-script-problem/ Share on other sites More sharing options...
dragon_sa Posted May 27, 2011 Share Posted May 27, 2011 does the directory your moving the file to have the correct permissions for writing to? Quote Link to comment https://forums.phpfreaks.com/topic/237630-php-upload-file-script-problem/#findComment-1221047 Share on other sites More sharing options...
GarryOne Posted May 27, 2011 Author Share Posted May 27, 2011 it's correct permission for directory Quote Link to comment https://forums.phpfreaks.com/topic/237630-php-upload-file-script-problem/#findComment-1221050 Share on other sites More sharing options...
gevensen Posted May 27, 2011 Share Posted May 27, 2011 you can try something like this and expand it if you need to it helps track down the little oopseys <?php include('utilities.php'); $debug_message="Start Debug<br/>"; $folder="data/images/"; $debug_message.=$folder".<br/>"; $foto=$folder.'file.txt'; $debug_message.=$foto".<br/>"; $need='txt'; $debug_message.=$need".<br/>"; if ($_FILES['foto']['tmp_name']) { $uploaded = $_FILES['foto']['tmp_name']; $debug_message.=$uploaded".<br/>"; $tmp = $folder." ".$uploaded; $debug_message.=$tmp".<br/>"; $ext=pathinfo($tmp, PATHINFO_EXTENSION); $debug_message.=$ext".<br/>"; if ($ext == $need) { if (file_exists($foto)) { unlink($foto); } move_uploaded_file($_FILES['foto']['tmp_name'], $foto); redir('page.php?rs=ok&pag=home'); } else { $_SESSION['error']='<p>Error. Try Again.</p>'; redir('page.php?pag=home'); } } else { $_SESSION['error']='<p>Upload File</p>'; redir('page.php?pag=home'); } echo $debug_message; ?> Quote Link to comment https://forums.phpfreaks.com/topic/237630-php-upload-file-script-problem/#findComment-1221068 Share on other sites More sharing options...
mikesta707 Posted May 28, 2011 Share Posted May 28, 2011 Just posting code and asking "Whats wrong" isn't going to get you anywhere. you need to make some effort to get your question answered. We have no clue what this script actually even does, so asking us to trudge through some code trying to find errors is something not a lot of people are going to want to do (as you can see by the lack of responses in this thread) why don't you explain exactly what the problem you are having is. What is happening when you run this script. What do you expect to happen? When you provide more detail than "this doesn't work.. halp" you can get an answer a lot easier. Quote Link to comment https://forums.phpfreaks.com/topic/237630-php-upload-file-script-problem/#findComment-1221696 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.