uploading a file
Can any one please help me in uploading a file from client to server. I have used cos.jar and commons upload file jar. They are working when we have to set the attribute enctype="multipart/form-data" of <form> tag.
But the problem is our framework will generate the <form> tag based on the html template. so it is setting the enctype="application/x-www-form-urlencoded". Is it possible to send a file to server using enctype="application/x-www-form-urlencoded". If it is, can you post the code.
thanks in advance
There are ways of doing this. URL.decode() or something
how about if the uploading (byte array) is sent from j2me to server, what is the syntax to retrieve the sent code?
javax.servlet.ServletRequest has several methods of getting files, we have to first determine the general nature of the file and what the operational arena can accept as a file.
There are two interfaces of consequence, javax.servlet.ServletRequest and javax.servlet.http.HttpServletRequest, both of which must be examined for candidate method calls. Java does not have a good and complete "upload file" coded and working, we have to dig rather deep for that and it is better if we can find one of the library methods to do the job. Best is to use getParameter(java.lang.String) which would then be sent to the server from a simple html form:
but that will not send binary data - to get the video type of bytes, I would try getInputStream() of ServletRequest - which brings a SerlvetInputStream ..... which is an abstract class ..... which brings us to a central design issue: What is it you are trying to achieve? If you are doing student work and chose to upload a video as a first project we must redirect your efforts and upload a simple text someting or other to start off with.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on Dec 16, 2008 6:38:56 AM -->
short video totally send to the server
<meta name="GENERATOR" content="Arachnophilia 5.1">
<meta name="FORMATTER" content="Arachnophilia 5.1">
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form action="http://yourSerlvet?val=someValue" method="post">
<input type="text" name="struggle with project" size="40" maxlength="80" value="Senior,I need your help about uploading file from j2me ">
For some reason, we seem to have too many people in the world who will use IPV4 spoofing to intrude on legitimate proprietary interests of commercial works. It just does not work, the situation is deeply involved in real-world issues that are not appropriate to five years out of college; some people never grasp the matter and others make a game of it. I have an eighteen hundred page book from Addison-Wesley Professional on the matter and I have to keep it hidden away as it is just too difficult to work the matter.
Try this code I posted earlier in the thread, that can be made into a JSP directly with beginner level skills, and would call a servlet. To make a servlet, you just subclass HttpServletRequest and start writing. It will be awhile before you get all of this working.
What books are you reading, what books have you read, how many lines of code have you written, what editor are you using and be sure to welcome Norm back.
Look at apache library for upload using servlet
h t t p://commons.apache.org/fileupload/