Uploading Access file
Hi to all
I am getting problem in uploading MS-accss and excel file.
Plz solve my problem.
Hi!
For uploading, SAP can handle only text-based files, for example CSV, TXT and so on.
You can save your excel in CSV for using the Save-as option in the excel.
Then you have to use the GUI_UPLOAD function for uploading.
Regards
Tamá
Similar Messages
-
I cannot access files I uploaded from an old computer. The email account to which some tracks are connected is deleted. For some reason my birth date doesn't work either. Is there some way to transfer the files to my current address and username?
Most likely you have Office 2004 which are PPC-only applications and will not work in Lion. Upgrade to Office 2011. Other alternatives are:
Apple's iWork suite (Pages, Numbers, and Keynote.)
Open Office (Office 2007-like suite compatible with OS X.)
NeoOffice (similar to Open Office.)
LibreOffice (a new direction for the Open Office suite.) -
Error in uploading a file in server
Hi,
We are working in a application whose technologies are Flex 4.0 and .Net 2010.
We are using .Net WCF Service for interacting with backend from the Flex front end.
In our application, we have requirement to upload a file from the client into a server.
We faced the following issue,
Security violation Issue #2032.
Solution: We have found that there is a sandbox restriction to access other domains, then we have placed the crossdomain.xml, which resolves the issue.
But this solution works only in the IE.
We are still getting the same error (Error #2032: Stream Error.) in other browsers - FireFox, Chrome and Safari.
Please let us know if there are any suggestions or solutions for this issue.
Regards,
GuruSiva,
You must apply modifiable binary type in wdDoInit of controller:
ISimpleType stype =
wdContext
.node<YourNode>()
.getNodeInfo()
.getAttribute("FileResource")
.getModifiableSimpleType();
IWDModifiableBinaryType mtype = (IWDModifiableBinaryType)stype;
/* Optional steps: affects only FileDownload control */
/* mtype.setMimeType( WDWebResourceType.JPG_IMAGE); */
/* mtype.setFileName( "picture.jpg" ); */
Sure, to make above work you must use binary type in context designer.
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Trying to get lighttpd to upload a file through perl cgi
Hi, I'm quite new in these things, so I might be doing something obvious wrong, but I'd like some help on this.
I'm trying to make a webpage where people can upload files, this is the html page (located at /srv/html/index.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>lighttpd Test Page</title>
</head>
<body>
<div style="text-align:center; font: 12px sans-serif;">
<span style="font-weight: bold; font-size: 20px;">
Arch Linux
</span>
<br><br>
This is a test page for the lighttpd Web Server.<br>
<form action="/cgi-bin/upload.pl" method="post" enctype="multipart/form-data">
<input type="file" name="fileName" size="40">
<input type="submit" value="Send">
<input type="reset">
</form>
</div>
</body>
</html>
And the backend (in /srv/html/cgi-bin/upload.pl):
#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Basename;
$CGI::POST_MAX = 1024 * 1024 * 5000; # 5GB filesize limit
my $safe_filename_characters = "a-zA-Z0-9_.-";
my $upload_dir = "/srv/jail/";
my $query = new CGI;
my $filename = $query->param("fileName");
if ( !$filename )
print $query->header ( );
print "There was a problem uploading your file (filesize limit may be exceeded).";
exit;
my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );
$filename = $name . $extension;
$filename =~ tr/ /_/;
$filename =~ s/[^$safe_filename_characters]//g;
if ( $filename =~ /^([$safe_filename_characters]+)$/ )
$filename = $1;
else
die "Filename contains invalid characters";
my $upload_filehandle = $query->upload("fileName");
open ( UPLOADFILE, ">$upload_dir/$filename" ) or die "$!";
binmode UPLOADFILE;
while ( <$upload_filehandle> )
print UPLOADFILE;
close UPLOADFILE;
print $query->header ( );
print <<END_HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Done!</title>
</head>
<body>
<p>Uploading done!</p>
</body>
</html>
END_HTML
My server config:
# lighttpd configuration file
# use it as a base for lighttpd 1.0.0 and above
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
############ Options you really have to take care of ####################
## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
# "mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
"mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root = "/srv/http/"
## where to send error-messages to
server.errorlog = "/var/log/lighttpd/error.log"
# files to check for if .../ is requested
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
## set the event-handler (read the performance section in the manual)
# server.event-handler = "freebsd-kqueue" # needed on OS X
# mimetype mapping
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
# default mime type
"" => "application/octet-stream",
# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr = "enable"
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag = "lighttpd"
#### accesslog module
accesslog.filename = "/var/log/lighttpd/access.log"
## deny access the file-extensions
# ~ is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
# of the document-root
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
# which extensions should not be handle via static-file transfer
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
######### Options that are good to be but not neccesary to be changed #######
## bind to port (default: 80)
server.port = ###
## bind to localhost (default: all interfaces)
#server.bind = "127.0.0.1"
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
server.pid-file = "/var/run/lighttpd/lighttpd.pid"
###### virtual hosts
## If you want name-based virtual hosting add the next three settings and load
## mod_simple_vhost
## document-root =
## virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
## virtual-server-root + http-host + virtual-server-docroot
#simple-vhost.server-root = "/srv/http/vhosts/"
#simple-vhost.default-host = "www.example.org"
#simple-vhost.document-root = "/htdocs/"
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
#server.errorfile-prefix = "/srv/http/errors/status-"
## virtual directory listings
#dir-listing.activate = "enable"
## enable debugging
#debug.log-request-header = "enable"
#debug.log-response-header = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found = "enable"
### only root can use these options
# chroot() to directory (default: no chroot() )
#server.chroot = "/"
## change uid to <uid> (default: don't care)
server.username = "http"
## change uid to <uid> (default: don't care)
server.groupname = "http"
#### compress module
#compress.cache-dir = "/var/cache/lighttpd/compress/"
#compress.filetype = ("text/plain", "text/html")
#### proxy module
## read proxy.txt for more info
#proxy.server = ( ".php" =>
# ( "localhost" =>
# "host" => "192.168.0.101",
# "port" => 80
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
#fastcgi.server = ( ".php" =>
# ( "localhost" =>
# "socket" => "/var/run/lighttpd/php-fastcgi.socket",
# "bin-path" => "/usr/bin/php-cgi"
#### CGI module
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl" )
#### SSL engine
#$SERVER["socket"] == "0.0.0.0:443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
# server.errorlog = "/var/log/lighttpd/error-ssl.log"
# accesslog.filename = "/var/log/lighttpd/access-ssl.log"
# server.document-root = "/home/lighttpd/html-ssl"
#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"
#### auth module
## read authentication.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
#auth.backend.ldap.filter = "(uid=$)"
#auth.require = ( "/server-status" =>
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# "/server-config" =>
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#evhost.path-pattern = "/srv/http/vhosts/%3/htdocs/"
#### expire module
#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
#### ssi
#ssi.extension = ( ".shtml" )
#### rrdtool
#rrdtool.binary = "/usr/bin/rrdtool"
#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
#### setenv
#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension = ".cml"
# cml.memcache-hosts = ( "127.0.0.1:11211" )
#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"
## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")
#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"
#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
The site is running over https with a self signed ssl-cert, if that matters. If I try to upload a file, the browser just quickly reloades the page, the filename still in the input field. The file isn't uploaded and the page that the script should display when completed doesn't show neither.
Does anyone know how to troubleshoot this? I'm not getting any errors, it just doesn't work..I haven't used Websphere before so I can't say much about that. Try putting <%@ page language="Java" %> at the top of your jsp page.
Try putting your java files into a package and see if that helps. I read somewhere that Tomcat once had issues with running classes that weren't in a package. Make sure to put the package statement at the top of your Java files if you do.
Websphere says it caught an unhandled exception. Instead of having your method throw and Exception put your code in a try-catch block and then print a stack trace to see if it says anything when it trys to read and write data.
Try{
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("doUpload.txt")));
ServletInputStream in = request.getInputStream();
int a=0;
a=in.read();
while (a!= -1){
pw.print((char) a);
a=in.read();
pw.close();
}catch(Exception e){
e.printStackTrace();
}Sorry I can't really give you more help.
-S- -
Uploading & Downloading Files into DMS Server using Web Dynpro Java
Hello Friends,
I want to Upload a file from Portal to Document Management Server and to Download a file from Document Management Server to Portal, In short, I want to give the user the facility to Upload a File into DMS Sever via Portal and also to download the file from DMS Sever via Portal.
Can anybody give me a Input for the same from Both Java Development End as well as ABAP End, more inputs are required from ABAP end, since i have a very less ABAP Experience on working with DMS. Few Questions i have in my mind?
1. How to actually access the file contents with the help of Document Number?
2. With the help of Doc-Number we can extract the file from DMS sever but to provide a option for downloading in portal, the RFC should convert the File Contents into X-String or is there some other way?
+3. While Uploading the Data should be given in Which format to RFC? Are there any limitation with respect to size or formats. Is there any Standard RFC i can use directly in WD4 Java application to upload the file into DMS Server and which will return me the Document Number? +
Please give me your valuable inputs.
Thank You.
Edited by: TusharShinde on Feb 21, 2011 11:13 AM
Now, I am able to download the File in Portal via my WD4 Java Application from DMS Server by passing the Document Number, but I am facing the problem in downloading the PDF files, Its not working for PDF files. Please give me inputs for the same.
Thank You.
Edited by: TusharShinde on Feb 22, 2011 10:13 AMHI,
Thanks for reply.
I am able to download the file From DMS server but I am still not able to Upload the File to DMS Server via Portal. For Download also it is working for all file formats but not for PDF any specific reason for the same.
function zhrf_rfc_dms_download_document.
*"*"Local Interface:
*" IMPORTING
*" VALUE(LV_DOCUMENT) TYPE DOKNR
*" EXPORTING
*" VALUE(LV_FADA) TYPE XSTRING
*" TABLES
*" LT_DOC STRUCTURE BAPI_DOC_FILES2
*" LT_OUT STRUCTURE ZST_DMS_FILE_XSTRING
data: ls_docfiles type bapi_doc_files2,
ls_dms type dms_doc_files,
lt_docfiles type standard table of bapi_doc_files2.
* data: LT_OUT type table of ZST_DMS_FILE_XSTRING.
data :wa_out like line of lt_out.
select single * from dms_doc_files
into ls_dms
where doknr = lv_document."Retrieve file
if sy-subrc = 0.
ls_docfiles-documenttype = ls_dms-dokar.
ls_docfiles-documentnumber = lv_document.
ls_docfiles-documentpart = ls_dms-doktl.
ls_docfiles-documentversion = ls_dms-dokvr.
* ls_docfiles-documenttype = '321'.
* ls_docfiles-documentnumber = LV_DOCUMENT.
* ls_docfiles-documentpart = '000'.
* ls_docfiles-documentversion = 'A0'.
endif.
call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
exporting
documenttype = ls_docfiles-documenttype
documentnumber = ls_docfiles-documentnumber
documentpart = ls_docfiles-documentpart
documentversion = ls_docfiles-documentversion
documentfile = ls_docfiles
getstructure = '1'
getcomponents = 'X'
getheader = 'X'
* pf_http_dest = 'SAPHTTPA'
pf_ftp_dest = 'SAPFTPA'
tables
documentfiles = lt_docfiles.
data: i_bin type standard table of sdokcntbin,
i_info type standard table of scms_acinf,
v_info type scms_acinf,
v_id type sdok_phid,
v_cat type sdok_stcat.
if sy-subrc = 0.
loop at lt_docfiles into ls_docfiles.
v_id = ls_docfiles-docfile.
v_cat = ls_docfiles-storagecategory.
call function 'SCMS_DOC_READ'
exporting
stor_cat = v_cat
doc_id = v_id
phio_id = ls_docfiles-file_id
tables
access_info = i_info
content_bin = i_bin
exceptions
bad_storage_type = 1
bad_request = 2
unauthorized = 3
comp_not_found = 4
not_found = 5
forbidden = 6
conflict = 7
internal_server_error = 8
error_http = 9
error_signature = 10
error_config = 11
error_format = 12
error_parameter = 13
error = 14
others = 15.
endloop.
if sy-subrc <> 0.
else.
data: v_xstring type xstring.
read table i_info into v_info index 1.
call function 'SCMS_BINARY_TO_XSTRING'
exporting
input_length = v_info-comp_size
importing
buffer = v_xstring
tables
binary_tab = i_bin
exceptions
failed = 1
others = 2.
if sy-subrc <> 0.
endif.
endif.
wa_out-file_name = ls_docfiles-docfile.
wa_out-binary = v_xstring.
lv_fada = v_xstring.
append wa_out to lt_out.
endif.
endfunction.
The above is the RFC Code, I am using in my WD4Java app for downloading the file From DMS Server, Is there any Improvement suggested for above RFC to make it work in more efficient way. Please give me input for my Upload RFC.
Thank You. -
Help please to Upload a file from my PC to server's KM
Hello:
I can't Upload correctly a file from my local PC to a KM of the server.
My problem is after that I've uploaded any file from my PC to KM, sometimes when I open or download it from the KM appears blank, and when I try another way to write the file (out.write()) I've uploaded a bad file that can't be downloaded or opened it. I can't get the file Data of the file for uploading, I need to set it with the fileResource (I tried with fileResource.read(false))
I use a FileUpload in my view.
<b>My Context:</b>
File (node)
|----fileResource (com.sap.ide.webdynpro.uielementdefinitions.Resource)
|----fileData (binary)
|----fileName (String)
wdDoInit(){
IPrivateUploadDownloadKMView.IFileElement fileBind = wdContext.createFileElement();
wdContext.nodeFile().bind(fileBind);
IWDAttributeInfo attInfo = wdContext.nodeFile().getNodeInfo().getAttribute("fileData");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
onActionSubir(){
IPrivateUploadDownloadKMView.IFileElement fileElement = wdContext.currentFileElement();
IWDResource resource = fileElement.getFileResource();
fileElement.setFileName(resource.getResourceName());
fileElement.setFileData(fileData);
byte[] fileData=new byte[resource.read(false).available()];
fileElement.setFileData(fileData);
fileName = fileElement.getFileName();
try{
File file = new File(fileName);
FileOutputStream out = new FileOutputStream(file);
out.write(fileElement.getFileData());
out.close();
fin = new FileInputStream(fileName);
fin.read();
Content content = new Content(fin,null, -1);
IResource newResource = folder.createResource(fileElement.getFileName(),null, content);
catch(Exception e){
IWDMessageManager mm = wdControllerAPI.getComponent().getMessageManager();
mm.reportWarning("error: "+e.getMessage());
Can you help me?, any sugestions to solve my problem or improve my code?
Regards
Jonatan.If you have got the permission to access <b>content management</b> in portal appliction server consle,then click on content management >select the KM Repository and clik on it.Then right click on <b>folder</b>>new-->upload.After clicking the upload option one page will be open and then you can browse your local file and upload to the KM Repository.
-
How to upload a file to the server using ajax and struts
With the following code iam able to upload a file ato the server.
But my problem is It is working fine if iam doing in my system nd when iam trying to
access theis application from someother system in our office which are connected through lan
iam getting an error called 500 i,e internal server error.
Why it is so???????
Plz help me????????
It is required in my project.
I want the code to access from every system.
My exact requirement is i have to upload a file to the server and retrive its path and show it in the same page from which we
have uploaded a file.
Here the file has to be uploaded to the upload folder which is present in the server.Iam using Tomcat server.
Any help highly appreciated.
Thanks in Advance
This is my input jsp
filename.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
alertflag = true;
var xmlHttp;
function startRequest(file1)
if(alertflag)
alert("file1");
alert(file1);
xmlHttp=createXmlHttpRequest();
var video=document.getElementById("filepath").value;
xmlHttp.open("POST","FilePathAction.do",true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.setRequestHeader('Content-Type', application/x-www-form-urlencoded');
xmlHttp.send("filepath="+file1);
function createXmlHttpRequest()
//For IE
if(window.ActiveXObject)
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//otherthan IE
else if(window.XMLHttpRequest)
xmlHttp=new XMLHttpRequest();
return xmlHttp;
//Next is the function that sets up the communication with the server.
//This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
function handleStateChange()
var message=" ";
if(xmlHttp.readyState==4)
if(alertflag)
alert(xmlHttp.status);
if(xmlHttp.status==200)
if(alertflag)
alert("here");
document.getElementById("div1").style.visibility = "visible";
var results=xmlHttp.responseText;
document.getElementById('div1').innerHTML = results;
else
alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
</script></head><body><form >
<input type="file" name="filepath" id="filepath" onchange="startRequest(this.value);"/>
</form>
<div id="div1" style="visibility:hidden;">
</div></body></html>
The corresponding action class is FIlePathAction
package actions;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
public class FilePathAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
String contextPath1 = "";
String uploadDirName="";
String filepath="";
System.out.println(contextPath1 );
String inputfile = request.getParameter("filepath");
uploadDirName = getServlet().getServletContext().getRealPath("/upload");
File f=new File(inputfile);
FileInputStream fis=null;
FileOutputStream fo=null;
File f1=new File(uploadDirName+"/"+f.getName());
fis=new FileInputStream(f);
fo=new FileOutputStream(f1);
try
byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
int len = -1;
while((len = fis.read(buf)) != -1)
fo.write(buf, 0, len);
catch(Exception e)
e.printStackTrace();
filepath=f1.getAbsolutePath();
request.setAttribute("filepath", filepath);
return mapping.findForward("filepath");
Action-mappings in struts-config.xml
<action path="/FilePathAction"
type="actions.FilePathAction">
<forward name="filepath" path="/dummy.jsp"></forward>
</action>
and the dummy.jsp code is
<%=request.getAttribute("filepath")%>MESSAGE FROM THE FORUMS ADMINISTRATORS and COMMUNITY
This thread will be deleted within 24 business hours. You have posted an off-topic question in an area clearly designated for discussions
about Distributed Real-time Java. Community members looking to help you with your question won't be able to find it in this category.
Please use the "Search Forums" element on the left panel to locate a forum based on your topic. A more appropriate forum for this post
could be one of:
Enterprise Technologies http://forums.sun.com/category.jspa?categoryID=19
David Holmes -
How can I access files that are saved in the iCloud?
Hello fellow apple fans,
I downloaded Mountain Lion yesterday and was very pleased to find out that it is possible to upload several file types from several programms into the iCloud. But now I am concerned that this feature could turn out to be useless for me: e.g. the PDF-upload from Preview" - once I uploaded it I can't find it annywhere, neither on my iPhone nor on icloud.com. I can only access it when I open Preview and look for "documents saved in the cloud". Same problem with several types of files - I can't find anything that can't be opend by the iWork-suit if I don't use the same programm that I used to save it in the cloud.
Is this feature only meant to help people that own more than one Mac?
Thanks for your help
Thadeus1991Unfortunately, you're right. You can open iCloud documents on multiple devices, but only if they have the exact same software. If you save documents on Preview or TextEdit on your Mac, you can't open them on your iPad or iPhone because there is no equivalent software.
I use Goodreader to read documents on my iPad and iPhone, and there is a workaround that I learned about on a popular Apple fan site that allows me to access my Goodreader iCloud files on my Mac (they are stored there even though there's no direct way to access them). Hopefully, Apple will address this issue and make such workarounds unnecessary. -
I have been using my iPad 2 to do job searches. Many websites ask me to upload my resume and/or a cover letter. I create these in Pages, and also save them as PDF files. When I click on the button to upload a file, the only choices I have are photos. Is there anyway to access other files saved on my iPad? Thanks!
RB
What version of Premiere Elements are you using and on what computer operating system is it running?
Whatever the case in your case....
You export your Timeline to file saved to the computer hard drive and from there upload it to YouTube at the YouTube web site.
Those YouTube extended time accounts are only for use at YouTube web site and not for use within the Premiere Elements YouTube feature.
Any questions or need clarification, please do not hesitate to ask. Depending on your Premiere Elements version, look at the AVCHD.mp4 choices
for your export to file saved to the computer hard drive.
Thanks.
ATR -
How do I upload a file to a website instead of a image
Hi
I'm trying to upload my cv to a job website on my iPad 3, but when I click on the websites upload button, it only allows me to select from the photos file on my iPad. Does anyone know how to change this to upload files, from Dropbox as an example.
CheersThere is no upload to website function in Pages.
Due to the security sandboxing of apps in iOS, each app only has access to its own files. You may be able to find an alternative browser that allows uploading of files other than photos. I believe "iCab" can do this. You would need to transfer the file you want to upload to the app doing the uploading first. Check the apps documentation for how to do this. -
Correct Approach in uploading a file
Which is the correct approach in uploading an image file.
Upload the file to the ApplicationServer and save the path in the DataBase
OR
Upload the file to the DataBase as BLOB.Usually I think you should just be storing the
location of the image in the database rather than the
image itself. However there are a couple of
disadvantages, chiefly that you need to keep the
database and file system in sync with each other and
that you don't have the database security to protect
your images.Perhaps more importantly (depending on your setup) there's the problem of accessing these auxilliary files from different hosts, and keeping the directory tidy. You can, of course, generally access through NFS but then your configuration on different machines had to take account of different file paths.
And you've got a second set of permissions to worry about. -
Problem in Uploading a File by Applet
Hi Members,
* I have faced problem while uploading a file from client to server by ftp protocol using APPLET(No JSP) only
* I am getting exception while running....
* My source code is as follows,
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class UploadAndDownload extends Applet implements ActionListener {
Button upload;
Button browse;
TextField filename;
File source = null;
Label name;
StringBuffer sb;
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
public void init() {
setLayout(new FlowLayout());
upload = new Button("Upload");
browse = new Button("Browse");
name = new Label("Filename");
filename = new TextField("", 45);
add(name);
add(filename);
add(upload);
add(browse);
upload.addActionListener(this);
browse.addActionListener(this);
public void actionPerformed(ActionEvent evt) {
// Code for browsing a file
String input_file_name = "";
if (evt.getSource() == browse)
Frame parent = new Frame();
FileDialog fd = new FileDialog(parent, "Select a file", FileDialog.LOAD);
fd.setVisible(true);
input_file_name = fd.getFile();
filename.setText(input_file_name);
// Gets the file from the file dialog and assign it to the source
source = new File(input_file_name);
repaint();
// Code for Uploading a file to the server
if (evt.getSource() == upload) {
// Appending the server pathname in string buffer
sb = new StringBuffer("ftp://");
sb.append("2847");
sb.append(':');
sb.append("Websphere25");
sb.append("@");
sb.append("172.16.1.111");
sb.append('/');
sb.append(input_file_name);
sb.append(";type=i");
try {
URL url = new URL(sb.toString());
URLConnection urlc = url.openConnection();
bos = new BufferedOutputStream(urlc.getOutputStream());
bis = new BufferedInputStream(new FileInputStream(source));
int i;
// Read from the inputstream and write it to the outputstream
while ((i = bis.read()) != -1) {
bos.write(i);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (bis != null)
try {
bis.close();
} catch (IOException ioe) {
ioe.printStackTrace();
if (bos != null)
try {
bos.close();
} catch (IOException ioe) {
ioe.printStackTrace();
MY EXCEPTION IS,
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission 172.16.1.111:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
at UploadAndDownload.actionPerformed(UploadAndDownload.java:68)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)* Please let me know what problem in my code....
* Thanks in advance....* Thanks for your reply....
* I have signed my policy file by giving AllPermission and mentioned in java.security file in bin folder....
* My question is , by giving AllPermission , can we access and do all permissions like ( SecurityPermission, AWTPermission, SocketPermission, NetPermission, FilePermission, SecurityPermission etc )...
* My policy file is looks like follow,
/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/
/* DO NOT EDIT */
grant {
permission java.security.AllPermission;
};* If i signed the policy like above, and when i run the applet file in InternetExplorer now , it thorws the following exception on my console,
java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
at UploadAndDownload.actionPerformed(UploadAndDownload.java:68)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)* Please let me know , how to solve this and give me your suggestion on the above process...
* Thanks in advance...
Regards,
JavaImran -
Uploading a file to server using ajax and struts
My problem is i wrote a program to upload a file to the server using Ajax.
Here iam used Struts and Ajax.
The problem is when iam uploaded a file from my PC the file is uploading to the server in the upload folder located in the server my system.
Iam using Tomcat server 5.0
But when iam trying to access it through other system it is not doing so
Giving an internal server error i,e 500.
Iam putting the necessary documents for ur reference.
Plz help me soon .
My exact requirement is i have to upload a file to the upload folder located in the server.
And i have to get the path of that file and display the file path exactly below the browse button from where iam uploaded a file.
That should be done without page refresh and submit thats y iam used Ajax
Any help would greatly appreciated
Thanks and Regards
Meerasaaheb.
The action class is FilePathAction
package actions;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
public class FilePathAction extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
String contextPath1 = "";
String uploadDirName="";
String filepath="";
System.out.println(contextPath1 );
String inputfile = request.getParameter("filepath");
uploadDirName = getServlet().getServletContext().getRealPath("/upload");
File f=new File(inputfile);
FileInputStream fis=null;
FileOutputStream fo=null;
File f1=new File(uploadDirName+"/"+f.getName());
fis=new FileInputStream(f);
fo=new FileOutputStream(f1);
try
byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
int len = -1;
while((len = fis.read(buf)) != -1)
fo.write(buf, 0, len);
catch(Exception e)
e.printStackTrace();
filepath=f1.getAbsolutePath();
request.setAttribute("filepath", filepath);
return mapping.findForward("filepath");
the input jsp is
filename.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
alertflag = false;
var xmlHttp;
function startRequest()
if(alertflag)
alert("meera");
xmlHttp=createXmlHttpRequest();
var inputfile=document.getElementById("filepath").value;
xmlHttp.open("POST","FilePathAction.do",true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send("filepath="+inputfile);
function createXmlHttpRequest()
//For IE
if(window.ActiveXObject)
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//otherthan IE
else if(window.XMLHttpRequest)
xmlHttp=new XMLHttpRequest();
return xmlHttp;
//Next is the function that sets up the communication with the server.
//This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
function handleStateChange()
var message=" ";
if(xmlHttp.readyState==4)
if(alertflag)
alert(xmlHttp.status);
if(xmlHttp.status==200)
if(alertflag)
alert("here");
document.getElementById("div1").style.visibility = "visible";
var results=xmlHttp.responseText;
document.getElementById('div1').innerHTML = results;
else
alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
</script></head><body><form name="thumbs" enctype="multipart/form-data" method="post" action="">
<input type="file" name="filepath" id="filepath" onchange="startRequest();"/>
</form>
<div id="div1" style="visibility:hidden;">
</div></body></html>
The ajax response is catching in a dummy.jsp
<%=(String)request.getAttribute("filepath")%>
corresponding action mapping
<action path="/FilePathAction" type="actions.FilePathAction">
<forward name="filepath" path="/dummy.jsp"/>
</action>
So plz help me to upload a file to the server from any PC.
Iam searched alot but didnt get any solution.Plz help me soon if it possible so
Iam in great need.
I have worked alot but not worked out.
Any help greatly appreciated -
NullPointerException while uploading wrong file in af:inputfile
Hi All,
I am uploading excel sheet data into jspx Page(database table) by using af:inputFile.After uploading file af:inputFile need to be refresh.It is getting refresh for right file(excel file),but it is not refreshing for wrong file upload.
it showing following error.
UIComponent is null
ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #2
i had refer frank's blog https://blogs.oracle.com/jdevotnharvest/entry/how_to_reset_adf_faces.
Could any one help on this!!
Thanks in advance!!here is my jspx source code.
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich" xmlns:h="http://java.sun.com/jsf/html">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document title="ExcelToTable.jspx" id="d1">
<af:messages id="m1"/>
<af:form id="f1" usesUpload="true">
<af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx" id="pt1">
<f:facet name="center">
<af:panelSplitter id="ps1" orientation="vertical" splitterPosition="146">
<f:facet name="first">
<af:panelFormLayout id="pfl2">
<af:panelLabelAndMessage label="#{bindings.Deptno.hints.label}" id="plam1">
<af:outputText value="#{bindings.Deptno.inputValue}" id="ot1">
<af:convertNumber groupingUsed="false" pattern="#{bindings.Deptno.format}"/>
</af:outputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.Dname.hints.label}" id="plam2">
<af:outputText value="#{bindings.Dname.inputValue}" id="ot2"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.Loc.hints.label}" id="plam3">
<af:outputText value="#{bindings.Loc.inputValue}" id="ot3"/>
</af:panelLabelAndMessage>
<f:facet name="footer">
<af:panelGroupLayout layout="vertical" id="pgl2">
<af:panelGroupLayout layout="horizontal" id="pgl3">
<f:facet name="separator">
<af:spacer width="10" height="1" id="s1"/>
</f:facet>
<af:commandButton actionListener="#{bindings.First.execute}"
text="First" disabled="#{!bindings.First.enabled}"
partialSubmit="true" id="cb1"/>
<af:commandButton actionListener="#{bindings.Previous.execute}"
text="Previous"
disabled="#{!bindings.Previous.enabled}"
partialSubmit="true" id="cb4"/>
<af:commandButton actionListener="#{bindings.Next.execute}" text="Next"
disabled="#{!bindings.Next.enabled}"
partialSubmit="true" id="cb5"/>
<af:commandButton actionListener="#{bindings.Last.execute}" text="Last"
disabled="#{!bindings.Last.enabled}"
partialSubmit="true" id="cb6"/>
</af:panelGroupLayout>
<af:commandButton text="Submit" id="cb7"/>
</af:panelGroupLayout>
</f:facet>
</af:panelFormLayout>
</f:facet>
<f:facet name="second">
<af:panelCollection id="pc1">
<f:facet name="menus"/>
<f:facet name="toolbar">
<af:toolbar id="t2">
<af:commandButton actionListener="#{bindings.CreateInsert.execute}"
text="InsertRow"
disabled="#{!bindings.CreateInsert.enabled}" id="cb2"
immediate="true"/>
<af:commandButton actionListener="#{bindings.Delete.execute}"
text="DeleteRow"
disabled="#{!bindings.Delete.enabled}" id="cb3"
immediate="true"/>
</af:toolbar>
</f:facet>
<f:facet name="statusbar"/>
<af:table value="#{bindings.EmpView3.collectionModel}" var="row"
rows="#{bindings.EmpView3.rangeSize}"
emptyText="#{bindings.EmpView3.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.EmpView3.rangeSize}" rowBandingInterval="0"
filterModel="#{bindings.EmpView3Query.queryDescriptor}"
queryListener="#{bindings.EmpView3Query.processQuery}"
filterVisible="true" varStatus="vs"
selectedRowKeys="#{bindings.EmpView3.collectionModel.selectedRow}"
selectionListener="#{bindings.EmpView3.collectionModel.makeCurrent}"
rowSelection="single" id="t1" partialTriggers="::cb2 ::cb3">
<af:column sortProperty="#{bindings.EmpView3.hints.Empno.name}"
filterable="true" sortable="true"
headerText="#{bindings.EmpView3.hints.Empno.label}" id="c1">
<af:inputText value="#{row.bindings.Empno.inputValue}"
label="#{bindings.EmpView3.hints.Empno.label}"
required="#{bindings.EmpView3.hints.Empno.mandatory}"
columns="#{bindings.EmpView3.hints.Empno.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Empno.precision}"
shortDesc="#{bindings.EmpView3.hints.Empno.tooltip}" id="it1">
<f:validator binding="#{row.bindings.Empno.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.EmpView3.hints.Empno.format}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Ename.name}"
filterable="true" sortable="true"
headerText="#{bindings.EmpView3.hints.Ename.label}" id="c2">
<af:inputText value="#{row.bindings.Ename.inputValue}"
label="#{bindings.EmpView3.hints.Ename.label}"
required="#{bindings.EmpView3.hints.Ename.mandatory}"
columns="#{bindings.EmpView3.hints.Ename.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Ename.precision}"
shortDesc="#{bindings.EmpView3.hints.Ename.tooltip}" id="it2">
<f:validator binding="#{row.bindings.Ename.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Job.name}" filterable="true"
sortable="true" headerText="#{bindings.EmpView3.hints.Job.label}"
id="c3">
<af:inputText value="#{row.bindings.Job.inputValue}"
label="#{bindings.EmpView3.hints.Job.label}"
required="#{bindings.EmpView3.hints.Job.mandatory}"
columns="#{bindings.EmpView3.hints.Job.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Job.precision}"
shortDesc="#{bindings.EmpView3.hints.Job.tooltip}" id="it3">
<f:validator binding="#{row.bindings.Job.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Mgr.name}" filterable="true"
sortable="true" headerText="#{bindings.EmpView3.hints.Mgr.label}"
id="c4">
<af:inputText value="#{row.bindings.Mgr.inputValue}"
label="#{bindings.EmpView3.hints.Mgr.label}"
required="#{bindings.EmpView3.hints.Mgr.mandatory}"
columns="#{bindings.EmpView3.hints.Mgr.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Mgr.precision}"
shortDesc="#{bindings.EmpView3.hints.Mgr.tooltip}" id="it4">
<f:validator binding="#{row.bindings.Mgr.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.EmpView3.hints.Mgr.format}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Hiredate.name}"
filterable="true" sortable="true"
headerText="#{bindings.EmpView3.hints.Hiredate.label}" id="c5">
<f:facet name="filter">
<af:inputDate value="#{vs.filterCriteria.Hiredate}" id="id1">
<af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
</af:inputDate>
</f:facet>
<af:inputDate value="#{row.bindings.Hiredate.inputValue}"
label="#{bindings.EmpView3.hints.Hiredate.label}"
required="#{bindings.EmpView3.hints.Hiredate.mandatory}"
columns="#{bindings.EmpView3.hints.Hiredate.displayWidth}"
shortDesc="#{bindings.EmpView3.hints.Hiredate.tooltip}"
id="id2">
<f:validator binding="#{row.bindings.Hiredate.validator}"/>
<af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
</af:inputDate>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Sal.name}" filterable="true"
sortable="true" headerText="#{bindings.EmpView3.hints.Sal.label}"
id="c6">
<af:inputText value="#{row.bindings.Sal.inputValue}"
label="#{bindings.EmpView3.hints.Sal.label}"
required="#{bindings.EmpView3.hints.Sal.mandatory}"
columns="#{bindings.EmpView3.hints.Sal.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Sal.precision}"
shortDesc="#{bindings.EmpView3.hints.Sal.tooltip}" id="it5">
<f:validator binding="#{row.bindings.Sal.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Comm.name}" filterable="true"
sortable="true" headerText="#{bindings.EmpView3.hints.Comm.label}"
id="c7">
<af:inputText value="#{row.bindings.Comm.inputValue}"
label="#{bindings.EmpView3.hints.Comm.label}"
required="#{bindings.EmpView3.hints.Comm.mandatory}"
columns="#{bindings.EmpView3.hints.Comm.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Comm.precision}"
shortDesc="#{bindings.EmpView3.hints.Comm.tooltip}" id="it6">
<f:validator binding="#{row.bindings.Comm.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="#{bindings.EmpView3.hints.Deptno.name}"
filterable="true" sortable="true"
headerText="#{bindings.EmpView3.hints.Deptno.label}" id="c8">
<af:inputText value="#{row.bindings.Deptno.inputValue}"
label="#{bindings.EmpView3.hints.Deptno.label}"
required="#{bindings.EmpView3.hints.Deptno.mandatory}"
columns="#{bindings.EmpView3.hints.Deptno.displayWidth}"
maximumLength="#{bindings.EmpView3.hints.Deptno.precision}"
shortDesc="#{bindings.EmpView3.hints.Deptno.tooltip}"
id="it7">
<f:validator binding="#{row.bindings.Deptno.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.EmpView3.hints.Deptno.format}"/>
</af:inputText>
</af:column>
</af:table>
</af:panelCollection>
</f:facet>
</af:panelSplitter>
</f:facet>
<f:facet name="header"/>
<f:facet name="start">
<af:panelGroupLayout id="pgl1">
<af:panelFormLayout id="pfl1">
<f:facet name="footer">
<af:commandButton text="Upload" id="uploadButton"
actionListener="#{FileProcessor.checkFile}" partialSubmit="true"/>
</f:facet>
<af:inputFile label="EmpFile" id="if1" value="#{FileProcessor.uploadedFile}"
partialTriggers="uploadButton" binding="#{FileProcessor.inputFile}"/>
<af:messages id="m2"/>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
<f:facet name="branding"/>
<f:facet name="copyright"/>
<f:facet name="status"/>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
and bean class code is as follows.
package xxorn.model.view;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import oracle.adf.view.rich.component.rich.input.RichInputFile;
import oracle.adf.view.rich.component.rich.output.RichMessages;
import oracle.adf.view.rich.context.AdfFacesContext;
import org.apache.myfaces.trinidad.model.UploadedFile;
import org.apache.myfaces.trinidad.util.ComponentUtils;
public class FileProcessor {
private CSVtoADFTableProcessor tablecreator;
private UploadedFile uploadedFile;
private String filename;
private long filesize;
private String filecontents;
private String filetype;
private RichMessages errorMsg;
private RichInputFile inputFile;
public FileProcessor() {
public void setUploadedFile(UploadedFile uploadedFile) {
this.uploadedFile = uploadedFile;
this.filename = uploadedFile.getFilename();
this.filesize = uploadedFile.getLength();
this.filetype = uploadedFile.getContentType();
try {
if (filename.endsWith(".csv"))
tablecreator.processCSV(uploadedFile.getInputStream());
else if(filename.endsWith(".xls")){
System.out.println("uploaded file is ********"+uploadedFile);
tablecreator.fileSubmit(uploadedFile.getInputStream());
//tablecreator.WriteXLS(uploadedFile.getInputStream());
else if (filename.endsWith(".xlsx")){
tablecreator.fileSubmitXSSF(uploadedFile.getInputStream());
//wrong file upload
else{
String msg="this is a global message.";
FacesContext ctx =FacesContext.getCurrentInstance();
FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "Please Upload proper file");
ctx.addMessage(null,fm);
} catch (IOException e) {
e.printStackTrace();
public void convertStreamToString(InputStream is) throws IOException {
StringBuilder sb = new StringBuilder();
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
System.out.println(sb.toString());
public UploadedFile getUploadedFile() {
return uploadedFile;
public void setFilename(String filename) {
this.filename = filename;
public String getFilename() {
return filename;
public void setFilesize(long filesize) {
this.filesize = filesize;
public long getFilesize() {
return filesize;
public void setFilecontents(String filecontents) {
this.filecontents = filecontents;
public String getFilecontents() {
return filecontents;
public void setFiletype(String filetype) {
this.filetype = filetype;
public String getFiletype() {
return filetype;
public void setTablecreator(CSVtoADFTableProcessor tablecreator) {
this.tablecreator = tablecreator;
public CSVtoADFTableProcessor getTablecreator() {
return tablecreator;
public void setErrorMsg(RichMessages errorMsg) {
this.errorMsg = errorMsg;
public RichMessages getErrorMsg() {
return errorMsg;
public String checkFile(ActionEvent actionEvent) throws Exception {
// Add event code here...
System.out.println("in upload action event");
/* RichInputFile vTheInputFileComponent = getInputFile();
vTheInputFileComponent.resetValue();*/
FacesContext vFacesContext = FacesContext.getCurrentInstance();
UIViewRoot vUIViewRoot = vFacesContext.getViewRoot();
RichInputFile vTheInputFileComponent =
(RichInputFile)vUIViewRoot.findComponent("if1");
vTheInputFileComponent.resetValue();
AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
adfFacesCtx.addPartialTarget(inputFile);
return null;
public void setInputFile(RichInputFile inputFile) {
this.inputFile = inputFile;
inputFile=null;
public RichInputFile getInputFile() {
return inputFile;
} -
Hi all,
I'm using JDeveloper 11.1.1.1.1.0. I followed Steve Muench's uploading example (http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85). The uploading works well with files undir 10k. But I get an error when I try to upload a file i.e. of size 22k. Both files are txt files. I also get the error when I use Steve's sample application. I've tried this on 2 different databases, XE 10g, and a 11g database. The error I get in the weblogic server is the following:
####<09-07-2009 17:26:30 CEST> <Error> <HTTP> <codd> <DefaultServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1247153190402> <BEA-101017> <[ServletContext@1749441[app:HealthResearchSupportSystem module:HealthResearchSupportSystem path:/HealthResearchSupportSystem spec-version:2.5 version:V2.0], request: weblogic.servlet.internal.ServletRequestImpl@56ff3d[
POST /HealthResearchSupportSystem/faces/uploadfile-flow/uploadFilesToProject?_adf.ctrl-state=p1bymyye6_37 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://127.0.0.1:7103/HealthResearchSupportSystem/faces/adf.dialog-request?_adf.ctrl-state=p1bymyye6_17&_rtrnId=0
Accept-Language: en-US,da;q=0.5
Content-Type: multipart/form-data; boundary=---------------------------7d937a857053a
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
Content-Length: 26512
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: oracle.uix=0^^GMT+2:00; JSESSIONID=55zHKWLLhrG2dyWtRNKTfCzGQnv5wYJxBQd4w6LTPNqdyMtVPH3b!-1454567202
]] Root cause of ServletException.
oracle.jbo.DMLException: JBO-26041: Kunne ikke postere data til database under "Tilbagestilling til sikringspunkt": SQL-sætning "null".
at oracle.jbo.server.DBTransactionImpl.rollbackToSavepoint(DBTransactionImpl.java:2988)
at oracle.jbo.server.DBTransactionImpl.restoreTmpPostState(DBTransactionImpl.java:1772)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2954)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1991)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2233)
at hrsusdatamodel.service.HRSuSAppModuleImpl.saveUploadedFile(HRSuSAppModuleImpl.java:1208)
at hrsusui.backing.UploadFilesToProject.fileUploaded(UploadFilesToProject.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
at org.apache.myfaces.trinidad.component.UIXEditableValue.broadcast(UIXEditableValue.java:214)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:444)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:701)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ProcessValidationsCallback.invokeContextCallback(LifecycleImpl.java:1178)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:291)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
java.sql.SQLException: Lukket forbindelse
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
I also traced the db-session and got the following in the trace file (only showing the end):
=====================
PARSING IN CURSOR #10 len=168 dep=1 uid=52 oct=47 lid=52 tim=1247153792975712 hv=337957580 ad='d2f665f0' sqlid='a6u3yjca29nqc'
declare
m_stmt varchar2(512);
begin
m_stmt:='delete from sdo_geor_ddl__table$$';
EXECUTE IMMEDIATE m_stmt;
EXCEPTION
WHEN OTHERS THEN
NULL;
end;
END OF STMT
PARSE #10:c=0,e=75,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,tim=1247153792975707
BINDS #10:
=====================
PARSING IN CURSOR #12 len=33 dep=2 uid=52 oct=7 lid=52 tim=1247153792976485 hv=1949913731 ad='d2f661a0' sqlid='3972rvxu3knn3'
delete from sdo_geor_ddl__table$$
END OF STMT
PARSE #12:c=0,e=576,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=1,tim=1247153792976480
BINDS #12:
EXEC #12:c=0,e=95,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=1,tim=1247153792976641
STAT #12 id=1 cnt=0 pid=0 pos=1 obj=0 op='DELETE SDO_GEOR_DDL__TABLE$$ (cr=0 pr=0 pw=0 time=0 us)'
STAT #12 id=2 cnt=0 pid=1 pos=1 obj=62986 op='TABLE ACCESS FULL SDO_GEOR_DDL__TABLE$$ (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)'
EXEC #10:c=0,e=908,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=1,tim=1247153792976748
XCTEND rlbk=0, rd_only=1
WAIT #0: nam='SQL*Net break/reset to client' ela= 19 driver id=1952673792 break?=1 p3=0 obj#=86504 tim=1247153792976925
WAIT #0: nam='SQL*Net break/reset to client' ela= 43 driver id=1952673792 break?=0 p3=0 obj#=86504 tim=1247153792976992
Any ideas what could be causing this? I get this error both in the example application and in my application. I also get this error in both the 10g (XE) database and in the 11g enterprise database.
Thanks in advance.
Sturla ThorThanks for your reply jflack.
I forgot to say that I had set those parameters:
<context-param>
<!-- Maximum memory per request (in bytes) -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
<!-- Use 500K -->
<param-value>512000</param-value>
</context-param>
<context-param>
<!-- Maximum disk space per request (in bytes) -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
<!-- Use 5,000K -->
<param-value>5120000</param-value>
</context-param>
<context-param>
<!-- directory to store temporary files -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_TEMP_DIR</param-name>
<!-- Use a TrinidadUploads subdirectory of /tmp -->
<param-value>/tmp/TrinidadUploads/</param-value>
</context-param>
<!-- This filter is always required; one of its functions is
file upload. -->
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
I also have checked if my upload directory has enough space.
Maybe you are looking for
-
Compaq CQ58-331SA / Webcam issue
Hi everyone, I'm having trouble with my HP Truevision HD webcam. After a few updates from HP a couple of days ago, my webcam stopped being detected by all kinds of video software. When I open Device Manager though, it does appear but there is a yello
-
Data Extraction from Informatica
Hi BI Gurus, I want to extract the data from SQL server through informatica. I went through SDN, but I am not able to found relevant information. Please share the steps (methods) or links or documents about data extraction from informatica. Regards,
-
When I want to buy an application from the store, he asks answer questions, but I forgot the answers, and chose Forgot answers send me to the site to re-set the questions and answers and chose re via e-mail and write to me I've sent you Lose mailbox
-
Hi, I want to migrate my Elements 8 (Windows XP)databas to iPhoto. Is that possible? Without new indexing (24000 Photos). THX for respons. Michael
-
Hi, I was working on an LR5 catalog yesterday (which I unfortantely didn't back up) and today it won't open. I don't even get an error message or a repair option, all LR does, is open a small grey window. I've read through a few threads, but I couldn