Răsfoiți Sursa

remove file name field from upload form

Pi 3 luni în urmă
părinte
comite
523e992f6e
2 a modificat fișierele cu 3 adăugiri și 14 ștergeri
  1. 2 2
      util-sqlpage/upload.sql
  2. 1 12
      util-sqlpage/upload/form.sql

+ 2 - 2
util-sqlpage/upload.sql

@@ -11,10 +11,10 @@ SET ":inner" = (CASE COALESCE(:inner, '')
   WHEN 'sqlpage/Open.sql' THEN :inner
   ELSE 'upload/Index.sql'
 END);
+SET ":file_name" = sqlpage.uploaded_file_name('content');
+SET ":mime_type" = sqlpage.uploaded_file_mime_type('content');
 -- although using a variable works, docs say to pass the function as first argument
 -- https://sql.ophir.dev/functions.sql?function=read_file_as_data_url#function
---SET ":file_name" = sqlpage.uploaded_file_name('content');
-SET ":mime_type" = sqlpage.uploaded_file_mime_type('content');
 SET ":content" = sqlpage.read_file_as_data_url(sqlpage.uploaded_file_path('content'));
 
 SELECT 'dynamic' AS component, sqlpage.run_sql('upload/temp.sql') AS properties

+ 1 - 12
util-sqlpage/upload/form.sql

@@ -14,9 +14,7 @@ SELECT 'Download' AS title
 , 'gray-500' AS color
 , '/upload/'||:hash AS link
 ;
---select 'button' as component;
---select name as title,  content as link
---from upload where name = '1.jpg' limit 1;
+
 SELECT 'form' AS component
 , '/upload.sql' AS action
 , 'Upload' AS validate
@@ -30,18 +28,9 @@ SELECT 'Upload' AS value
 , 'action' AS name
 WHERE NOT :view
 ;
-SELECT 'file_name' AS name
-, '' AS label
-, TRUE AS required
-, 'name.ext' AS placeholder
-, 'File Name' AS prefix
-, 4 AS width
-WHERE NOT :view
-;
 SELECT 'content' AS name
 , CASE :view WHEN FALSE THEN 'file' ELSE 'hidden' END AS type
 , '' AS label
-, TRUE AS required
 --, :view AS disabled
 , CASE COALESCE(:action, '')
   WHEN 'New' THEN NULL