Added stronger type assertion for file uploading