GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) πŸ’–

okay bestie, so this is the GOLF(2gg) page from the Development manual, and it's all about file-uploading πŸŽ€ pull up a chair, we're doing files today.


✨ NAME ✨

file-uploading β€” it's giving... files πŸ—‚οΈβœ¨ (yes the original literally just says "(files)", iconic minimalism, we love her)


🎯 PURPOSE 🎯

Upload a file to server. That's it. That's the whole vibe. 🫢


πŸ¦‹ SYNTAX πŸ¦‹

get-param <name>

πŸ‘‘ DESCRIPTION πŸ‘‘

So, files that get uploaded by a client (think a browser, curl, whatever your fave is 🌸) β€” you grab them with get-param.

Golf uploads files via HTML automatically, meaning you do not have to write any code for that specific purpose. No cap. An uploaded file gets stored in file-storage, with the path and name of that file generated by Golf so it's unique ✨. For example, a file you upload might be named:

/var/lib/gg/app_name/app//file/d0/f31881

(yes, double slash and all, that's just how she is πŸ’…)

When a file is uploaded, you can obtain the following input parameters β€” and for this example we're assuming the name attribute of the HTML input element is myfile:

  • "myfile_filename" is the name of the file as provided by the client. πŸ“
  • "myfile_location" is the full path on the server where file is stored (such as "/var/lib/gg/app_name/app//file/d0/f31881" for example) πŸ“
  • "myfile_ext" is the extension of the file, for example ".jpg" or ".pdf". Note that ".jpeg" is always showing as ".jpg". The extension is always lower case. πŸ‘€
  • "myfile_size" is the size of the file uploaded, as a string. See gg for setting the maximum file upload size. πŸ“

For example, for an HTML form which is uploading a file named "myfile", such as

<input type='file' name='myfile'>

your code that handles this might be:

get-param myfile_filename
get-param myfile_location
get-param myfile_ext
get-param myfile_size
You have uploaded file <<p-web myfile_filename>> to a server file at <<p-web myfile_location>>

and that's the whole flow, main character energy from start to finish 🌈


🌸 SEE ALSO 🌸

  • Files
  • change-mode close-file copy-file delete-file file-position file-storage file-uploading lock-file open-file read-file read-line rename-file stat-file temporary-file uniq-file unlock-file write-file
  • See all documentation

and that's the page, bestie!! this version is $VERSION, dated $DATE β€” go upload something cute πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from