Web Server: Sun Java System Web Server 7 update 5

I have inherited a JSP application and am trying to get it to work. I have figured out that it has something to do with the <input type="file"> tag, because I cut all the rest of the code out.

<input type="file" name="file_upload" maxlength="150" size="20" />
<input type="submit" name="UploadFile" value="Upload File" class="btn" onclick="return validate()" />

On submit, I get the following error:

javax.servlet.jsp.JspTagException: The file could not be written: java.io.FileNotFoundException: C:\WebApps\gpr\uploads\attachments\5217\c\DocumentsandSettings\gzjs4n\MyDocuments\227342050034.xls (The system cannot find the path specified)
	org.apache.jsp.att.attach_jsp._jspService(Unknown Source)
	com.cj.trim.trimFilter.doFilter(Unknown Source)

Notice how the error is referring to the file name as "C:\WebApps\gpr\uploads\attachments\5217\c\DocumentsandSettings\gzjs4n\MyDocuments\227342050034.xls". Basically, it is adding the whole (including path) name of the file instead of just taking the file name, which is "227342050034.xls". Since I have no other code creating this name, I do not know why this is happening.

Note: this could be a configuration problem, since I set up the Web Server myself and have not had any other experience doing this.

8 Years
Discussion Span
Last Post by ddempsey96

Dumb Question: Does the path that it is complaining about exist?

No. The path is not correct. It is tacking the whole directory to the end of the base directory. It would be correct if it was not doing that.

How do I add an update to my thread in this forum? Do I just create a reply like I am doing?

Here is the update: I found out that it is not the INPUT field that is causing the problem. But there is some client-side Javascript code that is executing on SUBMIT. So, I will look into that now.

function validate()

	var strTemp = document.frmAtt.fileDesc.value;
	var strTemp2 = document.frmAtt.file_upload.value;	
	strTemp2 = trimAll(strTemp2);

    if(strTemp2.length <= 0)
	alert('The filename can not be blank. File not uploaded.');
	return false;
    if(strTemp2.length > 150)

	alert('Please enter a path and filename less than or equal to 150 characters. File not uploaded.');
	return false;
	strTemp = trimAll(strTemp);

    if(strTemp.length <= 0)
	alert('Please enter a link description. File not uploaded.');
	return false;
	return confirm('Upload the file?');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.