I set the simple_php handlers to vault object.
When I press the Upload file, the GetInfoHandler is called as it is in an infinity loop.
It always returns value of 0, and UploadHandler never called!
Thanks in advance
It is really impossible situation. Either you have some problem with server php execution, then GetInfoHandler should have failed first. Please describe your setup in details.
I am having exactly the same problem. When i put the sample files in the tomcat it works fine. But when i put the files in my project and change the javascript location to
/js/dhtmlx/dhtmlxvault/codebase/dhtmlxvault.js and img path to /js/dhtmlx/dhtmlxvault/codebase/imgs/ and css path to /js/dhtmlx/dhtmlxvault/codebase/dhtmlxvault.css and place all the vault files at above location, i get a response code of ‘0’ from and it goes in infinte loop. Please help!!!
Sir, Tomcat is a java application server, how can you run php scripts on it?
Or you are trying JSP samples? In this case, please describe your server configuration.
yes i am running jsp version of the sample files. When I put the sample files which comes as a part of download package it runs perfectly fine. Now when I put the scripts required for the valut in the websphere development studio and change the path to the scripts to some thing like /js/dhtmlx/dhtmlxvalut/dhtmlxv…js it keeps on looping and the response code i get is ‘0’
I think it could be possible, that Websphere server has some impact on data uploading script. Try to debug it on your server. Unfortunately, I do not have Websphere (it is a commercial product of IBM), thus I cannot try it myself. Also, this kind of big app servers has a lot of tuning parts, it is hard to count everything in advance.
What you can do is to put a breakpoint in UploadHandler.jsp and check if it works fine on your server.
I am ready to help you to narrow this issue and fix it in our code if required. If you have more details or free trial for this app server, I want to try it.
Here is what we did. Created a sample project in websphere and try to run the sample vault. It works fine. Our Production application is a struts2 application and I think struts2 Multipart is handling the multipart request instead of dthmlx upload request. do you guys mind running this on the sample struts2 application and see if you are also facing the same issue. If yes could you please provide a solution to this. We already have purchased licensed version of vault and need to develop this solution ASAP. Your prompt response would be greatly appreciated.
Hi,
I’m experiencing the same problem. My setup is JEE environment delivering jsp running with struts under a Tomcat server. I managed though to get things to work…if the file is big enough !
When I send, let’s say, a 50MB large file, no problem, the upload script gets called on a regular basis, the progress bar fills up to 100%, and the file is saved through my upload script.
If the file is smaller, like 1 or 2 MB or smaller (note that my server is running on localhost, I did not try with a remote server, but I’m pretty sure this has to do with timing issues, right ?), the upload script gets not even called once, while the info script is called regularly for infinity (and even beyond), returning 0 no matter what.
So my guess would be that the transfer is so quickly done that the client somehow misses it and stays in some dirty state. What would be the solution to that problem ?
The forum seems a bit inactive, right ?
I’m still having my situation. Note that I’m using the pro version of the framework, should I go somewhere else to get some support ?
Otherwise, if someone knows how to help here, it would greatly be appreciated.
Thanks.
Hi,
with struts2 or some other framework, you should tune your server to allow multipart content for uploading script or servlet. It’s in struts configuration.
Hi,
if the file is small, it should be notified anyway before we can upload the second one. Could you please send your sample code so we can work on this issue?
Hi,
Thanks for your concern. I’m actually sending only one file at a time, even though that’s not changing anything I guess.
I began to include code in this message, but there are a lot of dependancies. To be fairly exhaustive even code I have no access to (library jars we must use). So I’ll insert here what I can.
The entry point code, directly in relation with dhtmlxvault is rather simple. It’s located in a jsp summoned by a struts action :
[...]
<div id="vaultDiv" style="z-index: 0;"></div>
<script>
var vault;
vault=new dhtmlXVaultObject();
vault.setFilesLimit( 1 );
vault.setImagePath("<s:url value='/js/dhtmlxVault/codebase/imgs/' />");
vault.setServerHandlers("<s:url value='/upload/send' />",
"<s:url value='/upload/info' />",
"<s:url value='/upload/id' />");
// This is used to send extra form data when the file is sent.
vault.onFileUploaded = function(file) {
document.getElementById('filename').value=file.name;
submitAddForm();
isSendingFile = false;
}
vault.create( "vaultDiv" );
</script>
Nothing suspicious here I think…
The 3 server handlers links summon struts. For security reasons I can’t directly access to the jsp files as I read at some places. So the struts configuration goes as this :
<package name="upload" extends="afw-default" namespace="/upload">
<action name="id">
<result name="success">/WEB-INF/jsps/upload/id.jsp</result>
</action>
<action name="send">
<result name="input">/WEB-INF/jsps/upload/send.jsp</result>
</action>
<action name="info">
<result name="success">/WEB-INF/jsps/upload/info.jsp</result>
</action>
</package>
And the associated 3 scripts, directly created from your given samples :
[*]id.jsp
[code]
<%@ page import=“org.apache.commons.fileupload." %>
<%@ page import="org.apache.commons.fileupload.servlet.” %>
<%@ page import=“java.io." %>
<%@ page import="java.util.” %>
<%
String id = request.getSession().getId().toString();
out.println(id);
session.setAttribute(“FileUpload.Progress.”+id,“0”);
%>
[/code][/]
[]send.jsp
[code]<%@page import=“com.inetpsa.afw.services.common.UploadService”%>
<%@page import=“org.springframework.web.context.support.WebApplicationContextUtils”%>
<%@page import=“org.springframework.context.ApplicationContext”%>
<%@ page import=“org.apache.commons.fileupload." %>
<%@ page import="org.apache.commons.fileupload.servlet.” %>
<%@ page import=“com.intspaa.afw.ui.web.upload.multipart." %>
<%@ page import="java.io.” %>
<%@ page import=“java.util.*” %>
<%@ taglib prefix=“s” uri="/struts-tags"%>
<%
UploadService upService = (UploadService)WebApplicationContextUtils.getWebApplicationContext(application).getBean(“uploadService”);
String uploadFolder = upService.getServerSidePath();
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
if (!isMultipart) {
out.println ("Use multipart form to upload a file!");
} else {
String fileId = request.getParameter(“sessionId”).toString().trim();
// Create a new file upload handler
FileItemFactory factory = new ProgressMonitorFileItemFactory(request, fileId);
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
//processFormField
} else {
//processUploadedFile
String fieldName = item.getFieldName();
String fileName = item.getName();
int i2 = fileName.lastIndexOf("\\");
if(i2>-1) fileName = fileName.substring(i2+1);
File dirs = new File(uploadFolder);
dirs.mkdirs();
File uploadedFile = new File(dirs,fileName);
item.write(uploadedFile);
session.setAttribute("FileUpload.Progress."+fileId,"-1");
}
}
}
%>[/code]
Unfortunately here are included packages even I don’t have sources from.[/*]
So, when the file is small enough, that last script (send.jsp) is never called, not even once. While info.jsp returns always 0. I’m not sure where the problem is because with a big file, send.jsp gets called for the first time at a point where the uploaded size is still 0…
Couldn’t find any edit function…
I forgot to inclue the rather small info.jsp file, but just in case, here you go :
<%
Object objProgression = session.getAttribute("FileUpload.Progress."+request.getParameter("sessionId").toString().trim());
out.println(objProgression);
%>
I can see one point which is wrong - are you using our library for multipart handling?
“fileupload-progress.jar”
Also, what happens when you click upload? Could you please monitor http traffic using firebug for example?
Fedor,
As a matter I am using your multipart library. The only difference is that due to external limitations, I couldn’t inclue any jar file. So I extracted the code and include .java files directly.
I searched the http requests and responses to find a solution as you were asking for. What happens is in fact that the send.jsp script gets called. But with small files, upload.parseRequest(request); simply returns an empty list. That is, once nailed down, the very difference I may observe.
Do this information help my case in any way ?
and if you look at this request in firebug? do you see some multipart content in it?
Here is the header information displayed in my browser (currently google chrome) :
[code]Request URL:http://localhost:8080/afw00Web/upload/send?sessionId=3754FB0B8D1FE80D3FFC3994D663014A&fileName=Chiffrage%20Alcatel.xlsx&userfile=file1
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:31180
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryZrnRiy8rot4xujMN
Cookie:JSESSIONID=3754FB0B8D1FE80D3FFC3994D663014A
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/afw00Web/information/manage-documents-upload
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1
Query String Parametersview URL encoded
sessionId:3754FB0B8D1FE80D3FFC3994D663014A
fileName:Chiffrage Alcatel.xlsx
userfile:file1
Request Payload
------WebKitFormBoundaryZrnRiy8rot4xujMN
Content-Disposition: form-data; name=“xMAX_FILE_SIZE”
10485760
------WebKitFormBoundaryZrnRiy8rot4xujMN
Content-Disposition: form-data; name=“UPLOAD_IDENTIFIER”
3754FB0B8D1FE80D3FFC3994D663014A
------WebKitFormBoundaryZrnRiy8rot4xujMN
Content-Disposition: form-data; name=“file1”; filename=“Chiffrage Alcatel.xlsx”
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
------WebKitFormBoundaryZrnRiy8rot4xujMN–
Response Headersview source
Content-Length:20
Content-Type:text/html;charset=utf-8
Date:Wed, 05 Oct 2011 09:07:24 GMT
Server:Apache-Coyote/1.1[/code]
I can’t see any difference (except of course IDs and file name) with the corresponding header when the file is bigger.
Are you using common libs from our archive?
commons-fileupload-1.1.jar
commons-io-1.1.jar
At least same versions?
Actually, I double checked this. I’m currently using 1.2.2 version of commons-fileupload and 2.0.1 of commons-io.
But to be sure, I removed these dependancies in our maven configuration, and replaced them with the 1.1 versions cleaned and redeployed everything. I still had the same symptoms.