-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw exception if disk is full #6
Comments
So I found the problem. I didn't have enough space on the disk. It would be better if the script threw an Exception to find the problem. It took me a lot of time to go through the script and find the problematic spot. |
@AlexanderMitov An exception in case the disk does not have enough space to host the file (but validation is passed)? That's a good idea but I'm not certain right now how to best do it. |
FileUploadFactory API improved, validator argument now optional array
I am still not sure where to throw an exception. Basically, if the $path in setTypeFromPath() is empty, that means $tmp_filename passed from processAll() is empty too. That can happen when the request contains no uploads at all. Now we discard empty uploads, so that should be resolved, but there is still no exception thrown on full disk, and I don't know how to differentiate empty uploads from uploads that didn't happen because the disk was full. If anyone else has ideas on this, you're welcome to post them. |
I think there are to points where this could happen. The first one is while uploading the file. It breaks becaus there is to less space on disk free. Maybe you have an error code reflectiong something like this. Another Option is to use the size provided by "content-disposition" and compare it with the value that "disk_free_space" gives you. The second point to throw an exception then the file is moved. Here its totally possible to get the filesize and check it against the disk_free_space. |
I know it's an old issue, but wouldn't be better to set a minimum free space value to accept uploads? If the server really doesn't have space, the upload may fail even before the php code gets executed. It would be better if could prevent getting to this point. The class could check that if the upload is completed, the free space will remain above the minimum threshold. In case it won't, an exception would be thrown. |
So for some reason when I pass big files, on some (no idea on what criteria) I get that finfo_file() doesn't recieve a file path. And indeed, when I var_dump() the $path variable passed to setTypeFromPath(), it is empty.
The text was updated successfully, but these errors were encountered: