What they're doing is the same as 99% of other sites that expect images. But it's probably fair to expect it to be even more streamlined (i.e: clear conversion instructions) given the circumstances of a time-limited exam.
<input type="file" accept="image/png, image/jpg, image/jpeg" />
If you do that, Safari will convert the HEIC image to a JPEG automatically when you try to upload it.What they did instead was to poorly reinvent the accept header in Javascript as follows:
<input
type="file"
...
onChange={async e => {
const split = file.name.split('.')
const fileType = split[split.length-1].toLowerCase()
const isAllowedExtension = extensions.includes(`.${fileType}`)
}}
/>
(per https://news.ycombinator.com/item?id=23261598).But going a bit bigger picture, the problem is that we still use file extensions to denote file type.
However, there were many other reports of students going the more "normal" route of just uploading through their iPhones, which caused the website to outright hang.
That’s quite impressive actually and much more than I would expect from a browser’s <input type=“file”> control.
JPEG conversions will vary in quality and size. On some sites (e.g. a CMS), quality can be sacrified to stay within file size limits.
On other sites, like photo printing services, quality is much more important.
These may be unusual cases, but silent browser assumptions are still an overstep.
The server is saying it can't read the other file type, so the alternative is to fail.
Convert the image to a format the site accepts (jpg)?
[ ] Don't show this message again
[OK] [Cancel]Also I'm not sure if you can generalize from your one relative to 99% of users.
Mime types can be spoofed and if you read the data blob's mime from its' type, then just an extension rename will fool it. But if you look at the magic numbers you're saving your server's resources and the uploader's time as it doesn't even try to move the file if the mime is not acceptable. No reason not to do it on the client-side first.
I mean ... isn't that kind of a classic trick when handing in homework you didn't make? Just rename some file to .doc and claim it got corrupted?
How is it possible that students that are being considered for "advanced placement" are not familiar with file formats?
how horrible and backward your education system must be? This belongs to basic literacy in the modern world.
Note we're not speaking about old people who were exposed to files for the first time while they had to balance a family life and other responsibilities.
We're speaking about people that were forced to spend more than half of their lives learning !!!
Even as a software engineer, I haven't used a desktop or windows in 5 years. I haven't used TheGimp (or any other non web/app image manipulation software) in 3 years.
from my experience converting ppt/word to pdf is a common enough use case that I would've assumed the majority of non-tech people run into it.
Latex is also a common case where you run into file extensions.
note I'm not expecting them to understand the difference between extensions, just what they mean and how to google how to convert between them.
The college board should have had a list of accepted formats, should have included instructions that they put in the tweet in the upload UI, and should have had an uploaded document verification process. This is solely the responsibility of the CB, and is deceitful at some level, by leading students to believe they were complying when they were not.
else if (!isAllowedExtension)
error = { title: 'This file type is not acceptable.', details: 'Please check the requirements, save your file in one of the accepted
formats, and resubmit.' }
Or, maybe theverge is just lying or relying on the misconception. If you think renaming your file is the same as converting your file, maybe you are misplaced in the advanced placement program...
Let's go with "no" for the sake of argument. They probably can't accept an mp3 of me singing my answers, either. But!
If I upload an HEIC, an mp3, a keynote file, or anything else unacceptable... Why doesn't the site provide an immediate "File format not accepted, please upload .gif, .jpg, or .png" message?
According to the article, the software would actually just hang. I think there's room to argue about whether they need to support the default format of an extremely significant platform for students. I think there's room to argue whether they should know enough about INPUT tags to let the browser help with this.
But while we're arguing about those questions, can't we all agree that simply hanging without providing a useful error message, and without giving the student an opportunity to re-upload their image... Is unacceptably poor software design for an institution that holds people's future in their hands?
I don't know about you, but if I were an American college student, I'd now be wondering what else they have kind of slapped together without thinking through graceful error handling?