Elusid Posted July 30, 2006 Share Posted July 30, 2006 Ok so I have this uploader and it's suposed to show text after the file was uploaded successfully. It was working but I did something to it. No errors and the files upload just fine... just no text... here's the code[code]<?php $dir = 'pending/apps/' . date('l \\t\h\e jS \of F Y g:i:s a').'/'; mkdir($dir); $file1 = $dir.basename($_FILES['snapshot']['name']); $file2 = $dir.basename($_FILES['userfile']['name']); $comments = $_POST['comments']; $commentsfile = fopen($dir . 'comments.txt','a+'); if ( (move_uploaded_file($_FILES['snapshot']['tmp_name'], $file1 )) && (move_uploaded_file($_FILES['userfile']['tmp_name'], $file2)) ) { if ( (filesize($file1) <= 20480) && (filesize($file2) <= 26214400 ) && fwrite($commentsfile,$comments) ) {echo 'All your information has been uploaded successfully. One of our staff members will look it over and if it passes our inspection, it will be on as soon as possible. Thank you.';}} else {echo 'Something went wrong during the upload please go to our contact page and tell us what happened.'; unlink($file1); unlink($file2);} ?> [/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 30, 2006 Share Posted July 30, 2006 Try this ok.[code]<?php $dir = 'pending/apps/' . date('l \\t\h\e jS \of F Y g:i:s a').'/'; mkdir($dir);$file1 = $dir.basename($_FILES['snapshot']['name']); $file2 = $dir.basename($_FILES['userfile']['name']); $comments = $_POST['comments']; $commentsfile = fopen($dir . 'comments.txt','a+'); if ((move_uploaded_file($_FILES['snapshot']['tmp_name'], $file1 )) && (move_uploaded_file($_FILES['userfile']['tmp_name'], $file2)) ) {}elseif ((filesize($file1) <= 20480) && (filesize($file2) <= 26214400 ) && fwrite($commentsfile,$comments) ) {echo 'All your information has been uploaded successfully. One of our staff members will look it over and if it passes our inspection, it will be on as soon as possible. Thank you.';} else {echo 'Something went wrong during the upload please go to our contact page and tell us what happened.'; unlink($file1); unlink($file2);} ?> [/code] Quote Link to comment Share on other sites More sharing options...
Elusid Posted July 30, 2006 Author Share Posted July 30, 2006 Nope still nothing. So back to the origonal code because both of these did the exact same thing. What is going wrong?! Quote Link to comment Share on other sites More sharing options...
Elusid Posted July 31, 2006 Author Share Posted July 31, 2006 any one?Please.... Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 31, 2006 Share Posted July 31, 2006 maybe try [code]<?php $dir = 'pending/apps/' . date('l \\t\h\e jS \of F Y g:i:s a').'/'; mkdir($dir); $file1 = $dir.basename($_FILES['snapshot']['name']); $file2 = $dir.basename($_FILES['userfile']['name']); $comments = $_POST['comments']; $commentsfile = fopen($dir . 'comments.txt','a+'); if ( (move_uploaded_file($_FILES['snapshot']['tmp_name'], $file1 )) && (move_uploaded_file($_FILES['userfile']['tmp_name'], $file2)) ) { if ( (filesize($file1) <= 20480) && (filesize($file2) <= 26214400 ) && fwrite($commentsfile,$comments) ) {echo ("All your information has been uploaded successfully. One of our staff members will look it over and if it passes our inspection, it will be on as soon as possible. Thank you.");}else{echo("The File is too big or somthing");}} else {echo 'Something went wrong during the upload please go to our contact page and tell us what happened.'; unlink($file1); unlink($file2);} ?> [/code]there that should work Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 1, 2006 Share Posted August 1, 2006 I would say that this condition[code]if ( (filesize($file1) <= 20480) && (filesize($file2) <= 26214400 ) && fwrite($commentsfile,$comments) )[/code]is failing, meaning that either filesize($file1) is greater than 20480 or filesize($file2) is greater than 26214400 or fwrite($commentsfile, $comments) failed. If you look at your code you will see that if this condition fails there is no text output. Quote Link to comment Share on other sites More sharing options...
Elusid Posted August 1, 2006 Author Share Posted August 1, 2006 But it can't be failing because it uploads everything just fine. If something would fail it would't upload itEDIT: Thanks BillyBoB that worked. So what exactly did you change to do that?EDIT; NVM I got it thanks! Quote Link to comment 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.