@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix content: <http://purl.org/rss/1.0/modules/content/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://lhero.org/?post_type=lh-portfolio-doc&#038;p=154069>
  a sioc:Post ;
  dc:title "Uploads Block" ;
  dcterms:identifier 154069 ;
  dc:modified "2026-11-07T22:54:41Z"^^xsd:dateTime ;
  dc:created "2026-11-07T22:08:04Z"^^xsd:dateTime ;
  sioc:link <https://lhero.org/portfolio/lh-share-target/uploads-block/> ;
  sioc:has_creator <https://lhero.org/author/1/#account> ;
  sioc:has_container <https://lhero.org/#posts> ;
  content:encoded "<ul class=\"lh_portfolio-meta\"><li><strong>Part of:</strong> <a href=\"https://lhero.org/portfolio/lh-share-target/\">LH Share Target</a></li></ul><p class=\"wp-block-paragraph\">Added in 1.1.0. The Uploads block (<code>lh-share-target/uploads</code>) is an upload form for any page. It exists because iPhones cannot use an installed web app as a share target, so this is the iOS route into the same pipeline as the Android share sheet.</p><h2 class=\"wp-block-heading\">What people see</h2><ul class=\"wp-block-list\"><li><strong>Logged-in users who can edit posts:</strong> a file picker (multiple files; on iPhone it offers Take Photo, Photo Library or Files), an optional title and note, and an upload button. Progress is shown while sending, and the button is disabled until the upload finishes, so one tap uploads once.</li><li><strong>Visitors:</strong> a log in link that returns them to the page.</li><li><strong>Logged-in users who cannot edit posts:</strong> nothing.</li></ul><h2 class=\"wp-block-heading\">Settings</h2><ul class=\"wp-block-list\"><li><strong>Button label</strong>: defaults to Upload.</li><li><strong>Accepted file types</strong>: the file input&#8217;s accept list, default <code>image/*,application/pdf</code>. This only shapes the picker; the server still applies the site&#8217;s allowed upload types.</li><li><strong>Send to post type</strong>: optional. When set, each upload is converted straight away to a draft of that post type (the user must be able to create it), as the share endpoint&#8217;s <code>lh_share_target-post_type</code> parameter does. Empty keeps uploads as staged Shares.</li></ul><h2 class=\"wp-block-heading\">How it works</h2><p class=\"wp-block-paragraph\">The form is rendered on the server. Its script posts the files, title and note as <code>multipart/form-data</code> to the share endpoint (<code>lh-share-target/v1/receive</code>) with the REST nonce, so the request is authenticated as the logged-in user. The endpoint stages the upload exactly as a share from the share sheet. The form needs JavaScript; without it a notice is shown.</p><h2 class=\"wp-block-heading\">Private staging</h2><p class=\"wp-block-paragraph\">Since 1.1.1 every share is staged as a <code>private</code> <code>lh_share</code> post, and its files as <code>inherit</code> attachments inserted with <code>wp_insert_attachment()</code>, so their path is known when <code>add_attachment</code> fires. LH Private Uploads keys privacy on post status, so where it is active the files go straight into the site&#8217;s private directory, outside the web root. There is no direct dependency: without LH Private Uploads the files stay in normal uploads.</p><ul class=\"wp-block-list\"><li><strong>Converting</strong> a share (from the editor panel or the block&#8217;s post type setting) changes its post type and makes it a draft for review. Leaving private moves its files back to public uploads.</li><li><strong>Expiry:</strong> a daily cron deletes staged shares (private, or draft from before 1.1.1) a week after they arrive. Deleting a share deletes its attachments with <code>wp_delete_post()</code>, which removes their files wherever they are stored.</li></ul>"^^rdf:XMLLiteral ;
  sioc:content "Part of: LH Share TargetAdded in 1.1.0. The Uploads block (lh-share-target/uploads) is an upload form for any page. It exists because iPhones cannot use an installed web app as a share target, so this is the iOS route into the same pipeline as the Android share sheet.What people seeLogged-in users who can edit posts: a file picker (multiple files; on iPhone it offers Take Photo, Photo Library or Files), an optional title and note, and an upload button. Progress is shown while sending, and the button is disabled until the upload finishes, so one tap uploads once.Visitors: a log in link that returns them to the page.Logged-in users who cannot edit posts: nothing.SettingsButton label: defaults to Upload.Accepted file types: the file input&#8217;s accept list, default image/*,application/pdf. This only shapes the picker; the server still applies the site&#8217;s allowed upload types.Send to post type: optional. When set, each upload is converted straight away to a draft of that post type (the user must be able to create it), as the share endpoint&#8217;s lh_share_target-post_type parameter does. Empty keeps uploads as staged Shares.How it worksThe form is rendered on the server. Its script posts the files, title and note as multipart/form-data to the share endpoint (lh-share-target/v1/receive) with the REST nonce, so the request is authenticated as the logged-in user. The endpoint stages the upload exactly as a share from the share sheet. The form needs JavaScript; without it a notice is shown.Private stagingSince 1.1.1 every share is staged as a private lh_share post, and its files as inherit attachments inserted with wp_insert_attachment(), so their path is known when add_attachment fires. LH Private Uploads keys privacy on post status, so where it is active the files go straight into the site&#8217;s private directory, outside the web root. There is no direct dependency: without LH Private Uploads the files stay in normal uploads.Converting a share (from the editor panel or the block&#8217;s post type setting) changes its post type and makes it a draft for review. Leaving private moves its files back to public uploads.Expiry: a daily cron deletes staged shares (private, or draft from before 1.1.1) a week after they arrive. Deleting a share deletes its attachments with wp_delete_post(), which removes their files wherever they are stored." ;
  sioc:topic <https://lhero.org/?taxonomy=author&term=cap-1>, <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261107t111700-uploads-block> .

<https://lhero.org/author/1/#account> rdfs:seeAlso <https://lhero.org/author/1/?feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=author&term=cap-1> rdfs:seeAlso <https://lhero.org/?taxonomy=author&term=cap-1&feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261107t111700-uploads-block> rdfs:seeAlso <https://lhero.org/?taxonomy=lh_object_key&term=lh-portfolio_doc_20261107t111700-uploads-block&feed=lhrdf&format=turtle> .
