[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 08-09-2005, 04:01 AM   #1 (permalink)
Barru.
 
Barrucadu's Avatar
 
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,731
78.50 NP$ (Donate)

Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold


This is a really noobish question...

On my image hosting site they're is a 1MB filesize limit, the script I use to check that is:

PHP Code:
//Check the size
if(!filesize($_FILES['uploadedfile']['name']) <= 1000000){
    echo
"File too large!"
    
echo "<p>Maximum size is 1MB</p>"
    
die("")
}
1st question: are there 1,000,000 bytes in a megabyte
2nd question: would that work?
Barrucadu is offline  
Old 08-09-2005, 04:23 AM   #2 (permalink)
Senior Member
 
scribby's Avatar
 
Join Date: May 2005
Location: Australia
Posts: 1,196
44.72 NP$ (Donate)

scribby is a glorious beacon of lightscribby is a glorious beacon of lightscribby is a glorious beacon of lightscribby is a glorious beacon of lightscribby is a glorious beacon of lightscribby is a glorious beacon of light


there are 1048576 bytes in 1mb

and die("") I dont think will work use die();

PHP Code:

//Check the size
if(!filesize($_FILES['uploadedfile']['name']) <= 1048576){
    echo
"File too large!";
    echo
"<p>Maximum size is 1MB</p>";
    die();
}
scribby is offline  
Old 08-09-2005, 09:13 AM   #3 (permalink)
NamePros Member
 
Join Date: Jan 2005
Location: Texas USA
Posts: 71
203.00 NP$ (Donate)

Outer is an unknown quantity at this point


You can use double quotes in the DIE() function

Wont affect anything. They are actually suppossed to be used for a message inside of the DIE() function
__________________
I wonder...
Outer is offline  
Old 08-09-2005, 10:00 AM   #4 (permalink)
DNOA Member
 
mholt's Avatar
 
Join Date: May 2004
Location: Utah
Posts: 5,041
18.01 NP$ (Donate)

mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future

Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Yeah, but there's no point, it's just extra typing.
__________________
codeboards

A high-quality community of programmers -- Join today and post! We want new members!
mholt is offline  
Old 08-09-2005, 11:25 AM   #5 (permalink)
NamePros Regular
 
moondog's Avatar
 
Join Date: Jun 2004
Posts: 476
3,677.00 NP$ (Donate)

moondog is a glorious beacon of lightmoondog is a glorious beacon of lightmoondog is a glorious beacon of lightmoondog is a glorious beacon of lightmoondog is a glorious beacon of lightmoondog is a glorious beacon of light


Quote:
Originally Posted by compuXP
Yeah, but there's no point, it's just extra typing.
You can certainly use is as:

die();

or

die("");

Quotes can be most useful to report back an error to the surfer if you want. I do this all the time when I write code for inept end-users. I will display a SPECIFIC error that I can trace back to the exact line in the code.

For example, if you are trying to open a file and it fails, you can always report the error something like this:

PHP Code:
<?
  $infile
= fopen('file.txt','r');
  if(!
$infile) {die("Error Opening File");}
?>
-Bob
__________________
The mass purge has begun.
moondog is offline  
Old 08-09-2005, 11:36 AM   #6 (permalink)
DNOA Member
 
mholt's Avatar
 
Join Date: May 2004
Location: Utah
Posts: 5,041
18.01 NP$ (Donate)

mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future

Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
well, yeah, but first an ugly error would appear - you'd want the @ character in the line.
__________________
codeboards

A high-quality community of programmers -- Join today and post! We want new members!
mholt is offline  
Old 08-09-2005, 01:11 PM   #7 (permalink)
Senior Member
 
Porte's Avatar
 
Join Date: May 2005
Location: Somewhere on earth!
Posts: 3,528
21.30 NP$ (Donate)

Porte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud ofPorte has much to be proud of


or

error_reporting(0);
__________________
Custom WordPress theme design. Top notch free WordPress themes
Custom Theme Design
Porte is offline  
Old 08-09-2005, 01:14 PM   #8 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


I rather use exit; :S

Also... i dont usually use those types of functions unless i cant use a if/else combo :-/ its better to me...
axilant is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Religious Question. Humdizzy The Break Room 99 06-22-2005 10:53 AM
Not at trick question Coastalguy The Break Room 5 05-04-2005 04:22 PM
Quick question... kektex Domain Newbies 1 03-31-2005 01:24 PM
little question.. khkhan Domain Appraisals 2 11-20-2004 04:28 AM
two-letter .com domain question questioning Domain Name Discussion 1 10-05-2004 04:08 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:15 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85