wp_upload_bits


wp_upload_bits ( $name, $deprecated, $bits, $time = null )

Parameters:
  • (string) $name Filename.
  • (null|string) $deprecated Never used. Set to null.
  • (mixed) $bits File content
  • (string) $time Optional. Time formatted in 'yyyy/mm'. Default null.
Returns:
  • (array)
Defined at:

Description

Create a file in the upload folder with given content.

If there is an error, then the key 'error' will exist with the error message. If success, then the key 'file' will have the unique file path, the 'url' key will have the link to the new file. and the 'error' key will be set to false.

This function will not move an uploaded file to the upload folder. It will create a new file with the content in $bits parameter. If you move the upload file, read the content of the uploaded file, and then you can give the filename and content to this function, which will add it to the upload folder.

The permissions will be set on the new file automatically by this function.

Related Functions

wp_upload_dir, _wp_upload_dir, wp_get_upload_dir, wp_max_upload_size, wp_preload_dialogs

Top Google Results

User discussions

wpseek mobile