Uolading videos on disk

Hi i need to upload video files on the disk... how can i do that?thanks
[92 byte] By [amrishkra] at [2007-11-27 4:15:36]
# 1
There are tons of examples available on the Internet. You may find Apache commons FileUpload useful. http://www.google.com/search?q=jsp+file+upload http://www.google.com/search?q=apache+commons+fileupload
BalusCa at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
hii hav tried everything but i m getting a lot of errors... plz tell me wat to do?
amrishkra at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
> plz tell me wat to do?First step is to give detailed information and ask specific questions.When saying meaninglessly "i hav tried everything but i m getting a lot of errors" we can't help you any much further.
BalusCa at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
sorry for not being specifici m not able to store the file in a particular directory on diskis it possible to store files of any size and type.?thanks
amrishkra at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

> i m not able to store the file in a particular directory on disk

Particular directory? Just define it in the File object.

File file = new File("/path/to/file", "filename.ext");

// or if you are sure that slashes are OK.

File file = new File("/path/to/file/filename.ext");

> is it possible to store files of any size and type.?

It just depends on authorization and the filesystem used. As long as the JVM has access to the specified location and the size does not exceed the limitations of the filesystem, you can store any kind of byte on the given location. The type and name doesn't matter.

BalusCa at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

i m using the following code:

index.jsp

<html>

<head>

<title>File Post</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>

<body>

<form action="post.jsp" method="post"

enctype="multipart/form-data" name="form1" id="form1">

<tr>

<td width="25%"><strong>File</strong></td>

<td><input type="file" name="file" /></td>

</tr>

<tr>

<td width="25%"> </td>

<td><input type="submit" name="Submit" value="Upload" /></td>

</tr>

</form>

</body>

</html>

post.jsp

<%@ page import="org.apache.commons.fileupload" %>

<%@ page import="org.apache.*"%>

<%@ page import="java.io.File"%>

<%@ page import="java.util.*"%>

<%@ page import="javax.servlet.http.*"%>

<%

boolean isMultipart=ServletFileUpload.isMultipartContent(request);

// Create a factory for disk-based file items

DiskFileItemFactory factory = new DiskFileItemFactory();

// Set factory constraints

factory.setSizeThreshold(100000);

factory.setRepository("/");

// Create a new file upload handler

ServletFileUpload upload = new ServletFileUpload(factory);

// Set overall request size constraint

upload.setSizeMax(100000);

// Parse the request

List items = upload.parseRequest(request);

File uploadedFile = new File("C://Documents and Settings/trainee/Desktop/xyz");

item.write(uploadedFile);

%>

and i m getting following error:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:6: package org.apache.commons does not exist

import org.apache.commons.fileupload;

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:55: cannot find symbol

symbol : variable ServletFileUpload

location: class org.apache.jsp.post_jsp

boolean isMultipart=ServletFileUpload.isMultipartContent(request);

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:57: cannot find symbol

symbol : class DiskFileItemFactory

location: class org.apache.jsp.post_jsp

DiskFileItemFactory factory = new DiskFileItemFactory();

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:57: cannot find symbol

symbol : class DiskFileItemFactory

location: class org.apache.jsp.post_jsp

DiskFileItemFactory factory = new DiskFileItemFactory();

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:64: cannot find symbol

symbol : class ServletFileUpload

location: class org.apache.jsp.post_jsp

ServletFileUpload upload = new ServletFileUpload(factory);

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:64: cannot find symbol

symbol : class ServletFileUpload

location: class org.apache.jsp.post_jsp

ServletFileUpload upload = new ServletFileUpload(factory);

^

An error occurred at line: 7 in the jsp file: /post.jsp

Generated servlet error:

C:\Documents and Settings\trainee\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\FileUpload\org\apache\jsp\post_jsp.java:73: cannot find symbol

symbol : variable item

location: class org.apache.jsp.post_jsp

item.write(uploadedFile);

^

7 errors

thanks

amrishkra at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Those are just ordinary compilation errors, not runtime errors.First resolve them using your basic Java knowledge, then we'll see further.
BalusCa at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
plz can you make things more clearMessage was edited by: amrishkr
amrishkra at 2007-7-12 9:21:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...