Skip to content

Unable to retrieve the file from a form file input #420

@abdalazizrashid

Description

@abdalazizrashid

Below is a sample code generated by the builder. The issue is that I can't retrieve the uploaded file, I tried form-multipart-data but it yielded nil and pretty much everything else I tried. Upon further inspection the issue seems to be that: I'm not getting the right connection id, inspecting the clog-connections::*connection-data* show that the uploaded file is actually there. So the problem is how can I get that connection id? And shouldn't form-multipart-data be able to do that?

;;;; CLOG Builder generated code - modify original .clog file and rerender
(in-package :clog-user)
(defclass panel-2 (clog:clog-panel)
          ((input-4 :reader input-4) (fbutton-3 :reader fbutton-3)
           (upload-file :reader upload-file) (form-1 :reader form-1)))
(defun create-panel-2 (clog-obj &key hidden class style html-id (auto-place t))
  (let ((panel
         (change-class
          (clog:create-div clog-obj :content
                           "<form action=\"\" onsubmit=\"return false;\" enctype=\"multipart/form-data\"
    target=\"_self\" data-clog-name=\"form-1\"
    style=\"box-sizing: content-box; position: absolute; left: 69px; top: 69px; width: 358px; height: 251px; overflow: visible;\"
    method=\"post\" id=\"CLOGB3949927956\">







    <input type=\"FILE\" value=\"\" data-clog-name=\"upload-file\"
        style=\"box-sizing: content-box; position: absolute; left: 68px; top: 83px;\"
        name=\"upload-file\" accept=\"*\" id=\"CLOGB3949927957\">

    <input type=\"submit\" value=\"Button-3\" data-clog-name=\"fbutton-3\"
        style=\"box-sizing: content-box; position: absolute; left: 67px; top: 189px;\"
        list=\"undefined\" id=\"CLOGB3949927958\">

    <input type=\"TEXT\" value=\"\" data-clog-name=\"input-4\"
        style=\"box-sizing: content-box; position: absolute; left: 77px; top: 21px;\"
        id=\"CLOGB3949927959\">
</form>"
                           :hidden hidden :class class :style style :html-id
                           html-id :auto-place auto-place)
          'panel-2)))
    (setf (slot-value panel 'input-4)
            (attach-as-child clog-obj "CLOGB3949927959" :clog-type
             'clog:clog-form-element :new-id t))
    (setf (slot-value panel 'fbutton-3)
            (attach-as-child clog-obj "CLOGB3949927958" :clog-type
             'clog:clog-form-element :new-id t))
    (setf (slot-value panel 'upload-file)
            (attach-as-child clog-obj "CLOGB3949927957" :clog-type
             'clog:clog-form-element :new-id t))
    (setf (slot-value panel 'form-1)
            (attach-as-child clog-obj "CLOGB3949927956" :clog-type
             'clog:clog-form :new-id t))
    (clog:set-on-submit (form-1 panel)
                        (lambda (target) (declare (ignorable target))))
    (clog:set-on-click (fbutton-3 panel)
                       (lambda (target)
                         (declare (ignorable target))
                         (let ((form (submit (form-1 panel))))
                           (break))))
    panel)) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions