I am using file_save_upload() function to upload my files in the Drupal 6 site. I want to limit the maximum file size to 1 MB for uploading.
In summary, “How can I measure the size before passing the file to file_save_upload() function?”
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use file_validate_size() to check the file’s size before calling file_save_upload()
Here are a few examples of these functions in use:
Drupal: File upload required?
Create image upload field using Drupal Form API