Hello,
I have a problem with my code.
I want to update my record with an upload when I insert a new record.
In my component (named imgdirect) I put in afterinsertrecord this :
Then in my AlphaPage (where I insert the imgdirect component) I put that :
My record is created with all the values but not the file I have choose to upload.
Thank you for your help.
[A5 for Web]
I have a problem with my code.
I want to update my record with an upload when I insert a new record.
In my component (named imgdirect) I put in afterinsertrecord this :
Code:
e.rv.session.clientid = e.primaryKeyValue
Code:
<%a5 dim msg as c = "" 'if eval_valid("cmd") dim fn as C 'fn = "[PathAlias.images]" + FileToUpload.filename if eval_valid("imgdirect_Button_Submit") if FileToUpload.filename <>"" file.from_blob(FileToUpload.filename, FileToUpload.data) 'msg = "<a href=\"/images/" + FileToUpload.filename + "\" target=\"_blank\">" + FileToUpload.filename + "</a> mise en ligne.<br /><br />" end if 'dta = "/images/"+FileToUpload.filename 'e.rv.session.clientid = e.rowData.data("clientid") ?session.clientid record_update("[PathAlias.ADB_Path]\clients.dbf","Clientid="+quote(session.clientid),dta) 'record_add("[PathAlias.ADB_Path]\clients.dbf","Lienimage="+dta,1) ' 'tbl = table.open("[PathAlias.ADB_Path]\Clients.dbf") 'tbl.enter_begin() 'tbl.Lienimage = "/images/" + FileToUpload.filename ''tbl.Name = FileToUpload.filename ''tbl.Uploaddate = now() 'tbl.enter_end(.t.) 'tbl.close() end if %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <%a5 'The componentAlias MUST be UNIQUE for each component on the page. It must not have spaces in the name. Keep name as short as possible dim componentAlias as c componentAlias = "imgdirect" Delete tmpl_imgdirect DIM tmpl_imgdirect as P tmpl_imgdirect = a5w_load_component("imgdirect") 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (LOAD:imgdirect) 'Following code allows you to override settings in the saved component. tmpl_imgdirect.override_settings = <<%override_settings% componentName = componentAlias _gridFilename = "imgdirect" %override_settings% 'TIP: To refer to local or page variables in the override_settings string, you must first define a local 'dot variable called 'pageVar' with properties for all of the variables you want to reference. For example: ' dim pageVar as p ' pageVar.gridRowCount = 10 'Then, in the override_settings string, you can reference pageVar.gridRowCount. For example: ' rows = pageVar.gridRowCount 'Resolve session and page variables in the override_settings string. a5w_resolveVariablesInOverrideSettings(tmpl_imgdirect,session,local_variables()) delete x_imgdirect dim x_imgdirect as p x_imgdirect = a5w_run_Component(tmpl_imgdirect) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (RUN:tmpl_imgdirect) (EDIT:imgdirect) if x_imgdirect.RedirectURL <> "" then response.redirect(x_imgdirect.redirectURL) end end if ?x_imgdirect.Output.Head.JavaScript ?x_imgdirect.Output.Head.CSS_Link x_imgdirect.Output.Body.DetailView_HTML = stritran(x_imgdirect.Output.Body.DetailView_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"") %> <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published --> <!--CSS for tmpl_imgdirect --> <link rel="stylesheet" type="text/css" href="file:///D:/Program Files/a5V10/css/GlassBlue/style.css"> <!--Alpha Five Temporary Code End --> <meta name="generator" content="Alpha Five HTML Editor Version 10 Build 2898-3552"> <!-- must use in order to make XP Themes render --> <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> </head> <body class="GlassBluePageBODY"> <p><br> <table><!--Table enclosing Grid component--> <tr><!--Table row for Grid Search Part--> <td><!--Table cell for Grid Search Part (Will be blank if Grid uses a Master Layout Template)--> <%A5 ?x_imgdirect.Output.Body.Search_HTML %></td><!--End table cell for Grid Search Part--> </tr><!--End table row for Grid Search Part--> <tr><!--Table row for Grid Part--> <td><%A5 ?x_imgdirect.Output.Body.Grid_HTML %></td> </tr><!--End table row for Grid Part--> <tr><!--Table row for Grid Detail View Part--> <td><!--Table cell for Grid Detail View Part (Will be blank if Grid uses a Master Layout Template)--> <%A5 ?x_imgdirect.Output.Body.DetailView_HTML %></td><!--End table cell for Grid Search Part--> </tr><!--End table row for Grid Search Part--> </table><!--End table enclosing Grid component--></p> </body></html>
Thank you for your help.
[A5 for Web]