Jump to content


Photo

Problem with showing text AFTER upload


  • Please log in to reply
6 replies to this topic

#1 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 30 July 2006 - 06:14 AM

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

<?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);
}

 ?> 


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 06:33 AM

Try this ok.


<?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);
}

 ?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 30 July 2006 - 02:19 PM

Nope still nothing. So back to the origonal code because both of these did the exact same thing. What is going wrong?!

#4 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 31 July 2006 - 11:17 PM

any one?
Please....

#5 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 31 July 2006 - 11:41 PM

maybe try

<?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);
}

 ?> 

there that should work

#6 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 01 August 2006 - 12:01 AM

I would say that this condition
if   (    (filesize($file1) <= 20480) && (filesize($file2) <= 26214400 ) && 

fwrite($commentsfile,$comments)    )
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.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#7 Elusid

Elusid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 01 August 2006 - 02:04 AM

But it can't be failing because it uploads everything just fine. If something would fail it would't upload it

EDIT: Thanks BillyBoB that worked. So what exactly did you change to do that?

EDIT; NVM I got it thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users