Results 1 to 5 of 5
Thread: uploading a file
- 09-14-2008, 09:18 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 1
- Rep Power
- 0
uploading a file
Hi All
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
siva
- 09-14-2008, 11:28 PM #2
There are ways of doing this. URL.decode() or something
Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 12-02-2008, 03:28 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 25
- Rep Power
- 0
how about if the uploading (byte array) is sent from j2me to server, what is the syntax to retrieve the sent code?
- 12-16-2008, 01:53 PM #4
Servlet Request
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.Java Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- Created on Dec 16, 2008 6:38:56 AM --> <html> <head> <title> short video totally send to the server </title> <meta name="GENERATOR" content="Arachnophilia 5.1"> <meta name="FORMATTER" content="Arachnophilia 5.1"> </head> <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 "> </form> </body> </html>
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.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 01-16-2009, 10:41 AM #5
Member
- Join Date
- Jan 2009
- Location
- italy
- Posts
- 16
- Rep Power
- 0
Look at apache library for upload using servlet
h t t p://commons.apache.org/fileupload/Last edited by peppem; 01-16-2009 at 11:19 AM.
Article and examples about Java EE world
http://programmaremobile.blogspot.com
Similar Threads
-
Uploading a file with Servlet
By farakhkhan@yahoo.com in forum New To JavaReplies: 0Last Post: 03-10-2008, 08:02 PM -
File Uploading
By aaliadhurue in forum Advanced JavaReplies: 4Last Post: 01-16-2008, 06:56 PM -
uploading files
By javaplus in forum Java AppletsReplies: 1Last Post: 01-13-2008, 10:14 PM -
Uploading image using JSP
By Java Tip in forum Java TipReplies: 0Last Post: 01-11-2008, 09:16 AM -
uploading sound file in java
By po0oker in forum Advanced JavaReplies: 8Last Post: 11-03-2007, 11:00 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks