file_upload(argname, destpath, maxsize)

file_upload(argname, destpath, maxsize). base. Captures a file provided by the user from temporary storage and copies it to the specified location. argname is the command-line argument that the form provided for the file upload control, destpath is where the file will be stored, and maxsize is the maximum permissible file size (in bytes) that can be uploaded. If the maximum size constraint is zero or negative, it will be ignored. If the file is too large, it will be ignored and deleted.

file_upload() returns a multi-line report, which can be split() into an array. The report describes the desired filename, the file size, the complete path (if the upload succeeded), the final filename (with dangerous characters replaced by safe substitutions), and the complete path the new file was meant to be given. If the upload failed, then the third line will be the string "null".

Categories