FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2000, 10:33 AM
whisperedlies whisperedlies is offline
Senior Idiot
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Posts: 25 whisperedlies User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm developing a message board, and in the user profile, one may upload a profile picture from their computer. i'd like to limit their picture size to, say, 50kb. I understand the ftp_size function, but I'd like to check the size before it's uploaded. Is that possbile?

Reply With Quote
  #2  
Old December 19th, 2000, 10:57 AM
Christopher Christopher is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 6 Christopher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Christopher
<?

if ($userfile_size > 50000) {
echo "file is too big.<br>";
echo "<a href='javascript:history.back()'>back</a>";
exit();
}

?>

Reply With Quote
  #3  
Old December 19th, 2000, 11:13 AM
whisperedlies whisperedlies is offline
Senior Idiot
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Posts: 25 whisperedlies User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks for responding. questions:

would i be right in saying that the $userfile variable would be the form input name from the submission form? well, i'll try playing with it and see what happens. thanks again.

Reply With Quote
  #4  
Old December 19th, 2000, 02:52 PM
kjedwards kjedwards is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 76 kjedwards User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m
Reputation Power: 8
Hi

Use something like this on the form which will upload your file -

<FORM ACTION="process_upload.php3" METHOD=POST ENCTYPE="multipart/form-data">
<input type=FILE name="userfile" size="30">

Then put the check for the file size in the process_upload.php3 script -

// Check file size in not too large
if ($userfile_size > 50000) { do whatever you want }

The variable $userfile comes from the name of the form field. _size returns the file size.

I hope this helps

Kevin


Reply With Quote
  #5  
Old March 11th, 2003, 08:04 PM
Bohsocks Bohsocks is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 Bohsocks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Bohsocks Send a message via Yahoo to Bohsocks
I don't understand ftp_size =(

$file= 'filename with space.txt';
$size = ftp_size($this->ftp, urldecode($file) );


Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > checking file size before ftp upload


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT