|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
|||
|
|||
|
<?
if ($userfile_size > 50000) { echo "file is too big.<br>"; echo "<a href='javascript:history.back()'>back</a>"; exit(); } ?> |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
I don't understand ftp_size =(
$file= 'filename with space.txt'; $size = ftp_size($this->ftp, urldecode($file) ); ![]() |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > checking file size before ftp upload |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|