I am trying to upload a file and I used the example here:
http://www.smartclient.com/smartgwte...se/#upload_sql
but I have issues.
My upload form is the following:
My Datasource:
I am using MSSQL. On my table definition I have:
f_id, primary key, with autoincrement.
f_datei, varbinary(max) null,
f_datei_date_created date null,
f_datei_filename varchar null,
f_datei_filesize int null.
When I click on the "save" Button, I get this exception:
So it seems the file is not being sent.
This is the firebug output:
My RPC Request/Reply on the developer console:
So only the filename is being sent, not the filesize, lastmodified, and the binary data if I read this correctly.
So what's going wrong?
I use SmartGWT EE 3.0p and Firefox 13.0.1.
Thank you!
http://www.smartclient.com/smartgwte...se/#upload_sql
but I have issues.
My upload form is the following:
Code:
final DynamicForm editDokumenteForm = new DynamicForm(); editDokumenteForm.setDataSource( DataSource.get( "dokumente" ) ); FileItem fileItem = new FileItem("f_datei", "Document"); editDokumenteForm.setFields( fileItem ); IButton editDokumenteOkButton = new IButton( "save" ); editDokumenteOkButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dokumenteEditForm.saveData(); } }
Code:
<DataSource ID="dokumente" serverType="sql" tableName="t_dokumente" > <fields> <field name="f_id" type="sequence" primaryKey="true" /> <field name="f_datei" type="imageFile" /> </fields> </DataSource>
f_id, primary key, with autoincrement.
f_datei, varbinary(max) null,
f_datei_date_created date null,
f_datei_filename varchar null,
f_datei_filesize int null.
When I click on the "save" Button, I get this exception:
Code:
=== 2012-07-02 10:13:52,634 [l0-3] DEBUG SQLTransaction - [builtinApplication.dokumente_add] Started new SQLSERVER transaction "14913826" === 2012-07-02 10:13:52,634 [l0-3] INFO SQLDriver - [builtinApplication.dokumente_add] Executing SQL update on 'SQLSERVER': INSERT INTO t_dokumente (f_datei) VALUES (?) === 2012-07-02 10:13:52,650 [l0-3] WARN SQLDriver - [builtinApplication.dokumente_add] Exception thrown during saveGeneratedKeys() com.microsoft.sqlserver.jdbc.SQLServerException: Die Anweisung muss ausgeführt werden, bevor Ergebnisse abgerufen werden können. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getGeneratedKeys(SQLServerStatement.java:2002) at org.apache.commons.dbcp.DelegatingStatement.getGeneratedKeys(DelegatingStatement.java:318) at com.isomorphic.sql.SQLServerDriver.saveGeneratedKeys(SQLServerDriver.java:266) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:539) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:482) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:604) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:403) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1388) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:293) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:245) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1291) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:67) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) === 2012-07-02 10:13:52,650 [l0-3] WARN RequestContext - dsRequest.execute() failed: com.microsoft.sqlserver.jdbc.SQLServerException: Wert für Parameternummer "1" wurde nicht festgelegt. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildParamTypeDefinitions(SQLServerPreparedStatement.java:262) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildPreparedStrings(SQLServerPreparedStatement.java:221) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:598) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:386) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:308) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:530) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:482) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:604) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:403) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1388) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:293) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:245) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1291) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:67) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) === 2012-07-02 10:13:52,651 [l0-3] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8 === 2012-07-02 10:13:52,651 [l0-3] DEBUG SQLTransaction - Rolling back SQLSERVER transaction "14913826" === 2012-07-02 10:13:52,653 [l0-3] DEBUG RPCManager - non-DMI response, dropExtraFields: false === 2012-07-02 10:13:52,653 [l0-3] DEBUG SQLTransaction - Ending SQLSERVER transaction "14913826" === 2012-07-02 10:13:52,653 [l0-3] INFO Compression - /zedes2/sc/IDACall: 176 -> 158 bytes
This is the firebug output:
Code:
Parameter: isc_rpc 1 isc_v v8.2p_2012-04-12 isc_xhr 1 Request Header: POST /zedes2/sc/IDACall?isc_rpc=1&isc_v=v8.2p_2012-04-12&isc_xhr=1 HTTP/1.1 Host: 127.0.0.1:8888 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Referer: http://127.0.0.1:8888/zedes2.html?gwt.codesvr=127.0.0.1:9997 Content-Length: 964 Cookie: JSESSIONID=1jah9ur5skg1j; isc_cState=ready Pragma: no-cache Cache-Control: no-cache Reply header: HTTP/1.1 200 OK Expires: Mon, 02 Jul 2012 08:13:52 GMT Content-Length: 158 X-Included-Test2: true X-Included-Test: true Cache-Control: no-cache Pragma: no-cache Content-Type: text/plain; charset=utf-8 Content-Encoding: gzip Server: Jetty(6.1.x) Post: <transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">14</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><values xsi:type="xsd:Object"><f_datei>mozodojo-original-image.jpg</f_datei><f_schueler_id xsi:type="xsd:long">2</f_schueler_id></values><operationConfig xsi:type="xsd:Object"><dataSource>dokumente</dataSource><operationType>add</operationType></operationConfig><componentId>isc_DynamicForm_2</componentId><appID>builtinApplication</appID><operation>dokumente_add</operation><oldValues xsi:type="xsd:Object"></oldValues></elem></operations></transaction> Reply: //isc_RPCResponseStart-->[{data:"Wert für Parameternummer \"1\" wurde nicht festgelegt.",invalidateCache:false,isDSResponse:true,queueStatus:-1,status:-1}]//isc_RPCResponseEnd
Code:
RPC Request: { "actionURL":"http://127.0.0.1:8888/zedes2/sc/IDACall", "showPrompt":true, "prompt":"Saving form...", "transport":"xmlHttpRequest", "promptStyle":"cursor", "bypassCache":true, "data":{ "values":{ "f_datei":"mozodojo-original-image.jpg", "f_schueler_id":2 }, "operationConfig":{ "dataSource":"dokumente", "repo":null, "operationType":"add" }, "componentId":"isc_DynamicForm_2", "appID":"builtinApplication", "operation":"dokumente_add", "oldValues":{ }, "streamResults":null, "exportToFilesystem":null, "exportToClient":null } } RPC Response: [ { data:"Wert für Parameternummer \"1\" wurde nicht festgelegt.", invalidateCache:false, isDSResponse:true, queueStatus:-1, status:-1 } ] DSRequest: { "dataSource":"dokumente", "operationType":"add", "componentId":"isc_DynamicForm_2", "data":{ "f_datei":"mozodojo-original-image.jpg", "f_schueler_id":2 }, "callback":{ "target":[DynamicForm ID:isc_DynamicForm_2], "methodName":"saveEditorReply" }, "showPrompt":true, "prompt":"Saving form...", "oldValues":{ }, "clientContext":{ }, "requestId":"dokumente$62716" }
So what's going wrong?
I use SmartGWT EE 3.0p and Firefox 13.0.1.
Thank you!
Comment