Bluehost.com Web Hosting $6.95

upload file size

This is a discussion on upload file size within the PHP General forums, part of the PHP Programming Forums category; Hi i really need help with an upload script. right now i use if ($HTTP_POST_FILES['userfile']['size']>$maxsize) { echo &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-14-2003
Joe
 
Posts: n/a
Default upload file size

Hi
i really need help with an upload script.
right now i use
if ($HTTP_POST_FILES['userfile']['size']>$maxsize) { echo "File too big";
exit; }
to determine if the file is larger than allowed.
but the problem is, that if the file IS larger, it is still first fully
uploaded and then checked. i tested it several times - if the file is much
larger than allowed, it displays the error message but the page loads a lot
longer and my computer is sending the file to the server.
this could really kill my bandwidth. is there a way to check the file size
without fully uploading the file?

thanks
joe
Reply With Quote
  #2 (permalink)  
Old 11-14-2003
Gerard Samuel
 
Posts: n/a
Default Re: [PHP] upload file size

On Friday 14 November 2003 12:48 pm, joe wrote:
> is there a way to check the file size
> without fully uploading the file?
>


No there isnt, well at least not via php...
Reply With Quote
  #3 (permalink)  
Old 11-17-2003
Raditha Dissanayake
 
Posts: n/a
Default Re: [PHP] upload file size

Gerard Samuel wrote:

>On Friday 14 November 2003 12:48 pm, joe wrote:
>
>
>> is there a way to check the file size
>>without fully uploading the file?
>>
>>
>>

>
>No there isnt, well at least not via php...
>



correct. There are two solutions you can upload with a java applet, the
applet can be configured to lock the upload at a predefined limit. Would
save you a lot of bandwidth. The second is to upload via perl script,
which can check the Content-length header *before* processing the file
upload and block it. In fact megaupload - the php upload progress bar
that i did some time ago has this feature.

sorry about the belated reply message had been stuck in a que..

>
>
>



--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
Reply With Quote
  #4 (permalink)  
Old 01-04-2004
Niclas Meyer
 
Posts: n/a
Default Re: [PHP] upload file size

wich kind of files are we talking about?

pictures or others?
"Gerard Samuel" <php-general@trini0.org> skrev i meddelandet
news:200311141338.52951.php-general@trini0.org...
> On Friday 14 November 2003 12:48 pm, joe wrote:
> > is there a way to check the file size
> > without fully uploading the file?
> >

>
> No there isnt, well at least not via php...

Reply With Quote
  #5 (permalink)  
Old 12-03-2004
Mike Parks
 
Posts: n/a
Default Re: upload file size

Joe
You would have to write a form validation script to check the file size.

Mike


Joe wrote:


> Hi
> i really need help with an upload script.
> right now i use
> if ($HTTP_POST_FILES['userfile']['size']>$maxsize) { echo "File
> too big";
> exit; }
> to determine if the file is larger than allowed.
> but the problem is, that if the file IS larger, it is still first fully
> uploaded and then checked. i tested it several times - if the file is
> much
> larger than allowed, it displays the error message but the page loads a
> lot
> longer and my computer is sending the file to the server.
> this could really kill my bandwidth. is there a way to check the file
> size
> without fully uploading the file?


> thanks
> joe






##-----------------------------------------------#
Article posted from PHP Freaks NewsGroup
http://www.phpfreaks.com/newsgroup
Get Addicted: php.genera
##-----------------------------------------------##
Reply With Quote
  #6 (permalink)  
Old 12-03-2004
Mike Parks
 
Posts: n/a
Default Re: upload file size

Joe
You would have to write a javascript form validation script to check the
file size.

Mike


Joe wrote:


> Hi
> i really need help with an upload script.
> right now i use
> if ($HTTP_POST_FILES['userfile']['size']>$maxsize) { echo "File
> too big";
> exit; }
> to determine if the file is larger than allowed.
> but the problem is, that if the file IS larger, it is still first fully
> uploaded and then checked. i tested it several times - if the file is
> much
> larger than allowed, it displays the error message but the page loads a
> lot
> longer and my computer is sending the file to the server.
> this could really kill my bandwidth. is there a way to check the file
> size
> without fully uploading the file?


> thanks
> joe






##-----------------------------------------------#
Article posted from PHP Freaks NewsGroup
http://www.phpfreaks.com/newsgroup
Get Addicted: php.genera
##-----------------------------------------------##
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:46 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0