Hello!
I have a grid with custom field with this code:
But when i try use on page (at the end o grid) FileToUpload.filename it's cause error:
Error:Script: /03_Mechanics/Default/mech_reg.a5w line:109
file.from_blob(fn, FileToUpload.filename)
Not found
FileToUpload.filename subelement not found."
Page code:
<html>
<head>
I have a grid with custom field with this code:
HTML Code:
<form action="" method="post" enctype="multipart/form-data"> <input type="file" name="FileToUpload" > <input type="submit" name="cmd" value="Upload File"> </form>
Error:Script: /03_Mechanics/Default/mech_reg.a5w line:109
file.from_blob(fn, FileToUpload.filename)
Not found
FileToUpload.filename subelement not found."
Page code:
<html>
<head>
Code:
<%a5 Delete tmpl_nav_main DIM tmpl_nav_main as P tmpl_nav_main = a5w_load_component("nav_main") 'Following code allows you to override settings in the saved component, and specify the component alias (componentName property). 'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short. 'Each component on a page must have a unique alias (componentName property). with tmpl_nav_main location = "" componentName = "nav_main" end with '=======================================compute the HTML for the Component======================================= delete x_nav_main dim x_nav_main as p x_nav_main = a5w_run_Component(tmpl_nav_main) ?x_nav_main.Output.Head.JavaScript ?x_nav_main.Output.Head.CSS_Link %> <%a5 Delete tmpl_NewUserReg DIM tmpl_NewUserReg as P tmpl_NewUserReg = a5w_load_component("NewUserReg") 'Following code allows you to override settings in the saved component, and specify the component alias (componentName property). 'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short. 'Each component on a page must have a unique alias (componentName property). with tmpl_NewUserReg componentName = "NewUserReg" end with '=======================================compute the HTML for the Component======================================= delete x_NewUserReg dim x_NewUserReg as p x_NewUserReg = a5w_run_Component(tmpl_NewUserReg) '============================================================================================================= if x_NewUserReg.RedirectURL <> "" then response.redirect(x_NewUserReg.redirectURL) end end if ?x_NewUserReg.Output.Head.JavaScript ?x_NewUserReg.Output.Head.CSS_Link %> <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published --> <!--CSS for tmpl_NewUserReg --> <link rel="stylesheet" type="text/css" href="file:///C:/Program Files/a5v9/css/BlueMoon/style.css"> <!--Alpha Five Temporary Code End --> <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published --> <!--CSS for tmpl_nav_main --> <link rel="stylesheet" type="text/css" href="file:///C:/Program Files/a5v9/css/Airport/components/a5navsysToolbar/style.css"> <!--Alpha Five Temporary Code End --> <meta name="generator" content="Alpha Five HTML Editor Version 9 Build 1522-3187"> <title>Edit Mechanic</title> </head> <body background=""> <p><table> <tr> <td><!-- Navigation System --> <%a5 ?x_nav_main.Output.Body.navsysTBH %> </td> </tr> <tr> <td> <br> <table> <tr> <td><%A5 ?x_NewUserReg.Output.Body.Grid_Echo %></td> </tr> <tr> <td><%A5 ?x_NewUserReg.Output.Body.UpdateErrors %></td> </tr> <tr> <td><%A5 ?x_NewUserReg.Output.Body.Search_HTML %></td> </tr> <tr> <td><%A5 ?x_NewUserReg.Output.Body.Grid_HTML x_NewUserReg.Output.Body.Grid_HTML = stritran(x_NewUserReg.Output.Body.Grid_HTML ,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"") %></td> </tr> <tr> <td><%A5 ?x_NewUserReg.Output.Body.DetailView_HTML %></td> </tr> </table> <%A5 dim msg as c = "" if eval_valid("cmd") dim fn as C Dim filename as C Dim strtposit AS N Dim ext AS C Dim doc_saved_as AS C filename = convert_type( FileToUpload,"C") '?FileToUpload strtposit = len(filename) - 2 '?strtposit ext = substr(filename,strtposit,3) if len(alltrim(filename)) > 4 then strtposit = len(filename) - 3 ext = substr(filename,strtposit,4) doc_saved_as = rand_string(20) + ext fn = "[PathAlias.ADB_Path]\images\\" + doc_saved_as ?fn file.from_blob(fn, FileToUpload.filename) msg = "<a href=\"/" + FileToUpload.filename + "\" target=\"_blank\">" + FileToUpload.filename + "</a> was uploaded<br /><br />" Dim tbl AS P tbl = table.open("[PathAlias.ADB_Path]\mechanics") query.filter = NewUserReg_filter tbl.query_create() tbl.fetch_first() tbl.enter_begin() tbl.Photo = fn tbl.enter_end(.t.) tbl.close() end if end if %> </td> </tr> </table> </p> </body></html>
Comment