PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am under a very tight deadline and I'm trying to get my upload_files class working. I'm trying to test this piece by piece. Brief synopsis:
The Upload_Files Class will validate the file extension (only certain file extensions can be uploaded), validate the file size (files larger than 25 MB are not allowed), and validate the user (banned users can not upload files). The code to check the file extension works. The code to validate the file size appears to be working but this is where I am having my problem. The code to prevent banned users from uploading is working. To test the size code, I put in a MAX_FILE_SIZE of 1MB and then tried to upload a file larger than 1MB. I set the MAX_FILE_SIZE hidden variable in the form and the variable that is passed in my code. I did not change the php.ini file which is set as the following:
; Maximum allowed size for uploaded files.
upload_max_filesize = 30M
The code to test the file size using 1MB as a MAX_FILE_SIZE worked fine. Now that I've changed it to be a max of 25MB, it doesn't work and I don't know why. Here is the pertinent code:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I would like to share some more stuff here. I have tested my code from less than 1 MB to 11.5 MB and its working fine but when i tried to upload a file of 11.7 MB, it says
"Form not submitted". I mean if i upload a file of 11.7 MB and more, it says "Form not submitted".
TIA.
I have a question relating to making sure only certain file types get uploaded. I scaned your code and I didn't see where it was done at.
Not that I have a suggestion or anything I'm just scanning through trying to learn by observation, when I can across this and wondered how you would do that.
So say I wanted only images (JPEG GIF PNG) to be allowed to be uploaded, how would I do that?
w35z0r wrote:I have a question relating to making sure only certain file types get uploaded. I scaned your code and I didn't see where it was done at.
Not that I have a suggestion or anything I'm just scanning through trying to learn by observation, when I can across this and wondered how you would do that.
So say I wanted only images (JPEG GIF PNG) to be allowed to be uploaded, how would I do that?
We have many threads on testing and validating file types. Look for them, please.
but i dont want to validate file types. I am just asking that when i upload file of 11.5 MB, it works but when i try to upload file of 11.7, it say " form not submitted ".
For future reference, the post data doesn't necessarily require the existence of the submit button.
As for your problem, amir, you probably need to adjust some other settings in your configuration. http://php.net/features.file-upload lists the directives that affect upload limits.