Pretty much. When we say something is a JPEG, we are referring to the file type and also its contents.
Sure. MIME types are an agreed-upon way to label or categorized file types. For example:
Great question!
/profile/image
or /pic/
send_from_directory()
function.
We'll see an example today.
The pathname is where the file is stored. For example, it might be stored in a local file: uploads/123.jpg
Or it might be in some shared folder: /students/teamacct/uploads/123.jpg
.
The latter directory would have to be world-writable, so that all the team members could write to it, but that's easily done.
The latter technique can work well for uploads to the team project, but I've also had lots of students develop locally and later transfer the code and files to the team account.
Sure. We can wrap a picture with a button or hyperlink, both of which are clickable elements:
Sure. let's do that. example code
Depends. For lots of purposes, such as thumbnails on a photo gallery or a profile picture, a modest size picture is fine. Maybe a quarter of a megabyte or so.
For some sites, you'll want to allow people to upload high-res photos.
If you're allowing people to upload PDFs for something, those might be quite large.
Create some sample files and look at their sizes.