this is a page of code on a Apache Tomcat server
the error i get is the following :

Eror :licenta\upload\Tulips.jpg (The system cannot find the path specified)

project path is :
ROOT\licenta

<%@ page import="java.io.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.FileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.FileItem"%>
<%@ page import="org.apache.commons.fileupload.FileItemIterator"%>
<%@ page import="org.apache.commons.fileupload.FileItemStream"%>
<%@ page import="org.apache.commons.fileupload.util.Streams"%>
<html>
	<head>
	</head> 
	<body>
		<form action="file_up.jsp" enctype="multipart/form-data" method="post">
			 What is your name? <INPUT type="text" name="submit-name"><BR>
			What files are you sending? <input type="file" name="file">
			<input name="submit" type="submit" value="Upload photo">
			<INPUT type="reset">
		</form>
		<%
		String result = null;
		try {
			if(ServletFileUpload.isMultipartContent(request)){
			
				DiskFileItemFactory factory = new DiskFileItemFactory();

				ServletFileUpload upload = new ServletFileUpload(factory);
				
				upload.setSizeMax(-1);
				
				List items = upload.parseRequest(request);
				
				Iterator iter = items.iterator();
				
				while (iter.hasNext()) {
					FileItem item = (FileItem) iter.next();
					if (!item.isFormField()) {
						String fileName = item.getName();
						String contentType = item.getContentType();
						boolean isInMemory = item.isInMemory();
						long sizeInBytes = item.getSize();
						File fup = new File("licenta/upload/"+fileName);
						item.write(fup);
					}else{
						String name = item.getFieldName();
						String value = item.getString();
					}
				} 
			}
		}
		catch(Exception ex){
			result = "Eror :" + ex.getMessage();
		}
		out.println(result);
		%>
	</body>
</html>

As error says, file cannot be found as you are providing relative path. You should have provided absolute path

can you give me an example?
in the documentation it says that a absolute path is one with / at the front
and i tried that too and got the same error.
i am working on Windows operating system but the server is apache tomcat
if it makes any difference
thank you for your time

If you working on Windows then absolute path would be drive letter with directions to file, example C:\Images\img01.jpeg

C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\examples\images\
i pasted that from explorer
and got this error

An error occurred at line: 44 in the jsp file: /licenta/file_up.jsp
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

i replaced \ with \\ and it worked thank you very much
will try next to save in project folder

again thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.