File Upload in UNIX Problem in using fileaccess.HttpUploadBean
Hi,
Some one please help me on File uploading in UNIX using fileaccess.HttpUploadBean.
My program is working fine for windows , but when i am running same profram to upload the file in Unix Environment it is giving exception.
fileaccess.properties for UNIX.
fileaccess.basedir = /usr
Under /usr i have tmp directory, and in my beanUploadExample.jsp i have defined userdir = "tmp"; but while uploading it throws "IOException = tmp is not a directory". tmp is a existing directory under /usr and i am having write permission into it.
Please help me on this.
Thanks in advance
Avoid Multipost
http://forum.java.sun.com/thread.jspa?threadID=5216365
Similar Messages
-
Flex and php file uploader cross browser problems
Hi, I have a problem in flex and php file uploader. It was
working fine in Internet Explorer, but nothing would work in
Firefox and in other browsers. Firefox and other browsers was not
sending the session with the file upload and was producing a login
error. On IE the session cookie is picked up and the upload request
uses the authenticated session, no login error. I'm newbie in flex.
Please help me. Thanks in advance!
Here's my code:
bgupload.mxmlHello, I am Gamaliel Arredondo, i have solved this problem, the error is in the code, you have a mistake in your code, check it out.
The way to run the flex applications, in my case, i installed xampp, in the htdoc directory i put the folder with the files of the application and all is working very well, only when the apache is running because if it is stoped the application show error, please review your code and if you have problems you can contact me by e-mail ([email protected]) i also fought with that problem but i could find the solution, i hope to help you. -
File upload in Mozilla problem
Hi,
I am using Flex with server side php script to upload a file
from Flex to server and everything works fine when i use Internet
Explorer but in Firefox i get the following "Error #2038: File I/O
Error".
I googled around and found out that there is a problem with
Firefox handling sessions but couldn't find solution to this
problem. Has anyone else came across this problem, what would be
the solution to it?
Here is my mxml code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init();">
<mx:Script>
<![CDATA[
private var urlRequest:URLRequest;
private var fileReferenceList:FileReferenceList;
private var serverSideScript:String = "
http://localhost/uploadFile.php";
private function init():void {
urlRequest = new URLRequest(serverSideScript);
fileReferenceList = new FileReferenceList();
fileReferenceList.addEventListener(Event.SELECT,
fileSelectedHandler);
private function uploadFile():void {
fileReferenceList.browse();
private function fileSelectedHandler(event:Event):void {
var fileReference:FileReference;
var fileReferenceList:FileReferenceList =
FileReferenceList(event.target);
var fileList:Array = fileReferenceList.fileList;
// get the first file that the user chose
fileReference = FileReference(fileList[0]);
// upload the file to the server side script
fileReference.addEventListener(Event.COMPLETE,
uploadCompleteHandler);
fileReference.upload(urlRequest);
// update the status text
statusText.text = "Uploading...";
private function uploadCompleteHandler(event:Event):void {
statusText.text = "File Uploaded: " + event.target.name;
]]>
</mx:Script>
<mx:Label text="Upload File From Flex to PHP"
fontWeight="bold"/>
<mx:Label text="Choose a file..." id="statusText"/>
<mx:Button click="uploadFile();" label="Upload File"/>
</mx:Application>
And my php script:
<?php
$tempFile = $_FILES['Filedata']['tmp_name'];
$fileName = $_FILES['Filedata']['name'];
$fileSize = $_FILES['Filedata']['size'];
move_uploaded_file($tempFile, "./" . $fileName);
?>Hi,
I am using Flex with server side php script to upload a file
from Flex to server and everything works fine when i use Internet
Explorer but in Firefox i get the following "Error #2038: File I/O
Error".
I googled around and found out that there is a problem with
Firefox handling sessions but couldn't find solution to this
problem. Has anyone else came across this problem, what would be
the solution to it?
Here is my mxml code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init();">
<mx:Script>
<![CDATA[
private var urlRequest:URLRequest;
private var fileReferenceList:FileReferenceList;
private var serverSideScript:String = "
http://localhost/uploadFile.php";
private function init():void {
urlRequest = new URLRequest(serverSideScript);
fileReferenceList = new FileReferenceList();
fileReferenceList.addEventListener(Event.SELECT,
fileSelectedHandler);
private function uploadFile():void {
fileReferenceList.browse();
private function fileSelectedHandler(event:Event):void {
var fileReference:FileReference;
var fileReferenceList:FileReferenceList =
FileReferenceList(event.target);
var fileList:Array = fileReferenceList.fileList;
// get the first file that the user chose
fileReference = FileReference(fileList[0]);
// upload the file to the server side script
fileReference.addEventListener(Event.COMPLETE,
uploadCompleteHandler);
fileReference.upload(urlRequest);
// update the status text
statusText.text = "Uploading...";
private function uploadCompleteHandler(event:Event):void {
statusText.text = "File Uploaded: " + event.target.name;
]]>
</mx:Script>
<mx:Label text="Upload File From Flex to PHP"
fontWeight="bold"/>
<mx:Label text="Choose a file..." id="statusText"/>
<mx:Button click="uploadFile();" label="Upload File"/>
</mx:Application>
And my php script:
<?php
$tempFile = $_FILES['Filedata']['tmp_name'];
$fileName = $_FILES['Filedata']['name'];
$fileSize = $_FILES['Filedata']['size'];
move_uploaded_file($tempFile, "./" . $fileName);
?> -
Issue with large file uploads 2MB to SharePoint 2013 using CSOM in BizTalk 2013
Hi,
I am getting errors when I try to upload any file > 2MB to any SP site using BT 2013 CSOM .
Any file less than this processes successfully.
Any one having experience in correcting the issue ?
Thanks
Ritu Raj
Regards
Ritu Raj
When you see answers and helpful posts,
please click Vote As Helpful, Propose As Answer, and/or Mark As AnswerDid you try asking in a SharePoint forum?
Thanks!
Ed Price, Azure & Power BI Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
Shortdump on File upload from unix and CX_SY_CONVERSION_CODEPAGE
Hi,
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was no
caught in
procedure "OPEN_INPUT_FILE" "(FORM)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4102' is not known to the system.
Example: µ is creating problems.
I have a problem in uploading the file with below format
F091US122580164 PECOSPHERE C18,3µm,33X4.6MM
1. I am using a custom program to read the file and then updating internal table
2. Unicode code system
Please help to resolve this issue.
Thanks and Regards,
RaveendraHi Raveendra,
Similar problem is faced by me in my current project. The solutions I have suggested are as below. I have not received any confirmation as to which solution to be applied.
To avoid the dump:
1. Read the file as a NON UNICODE file.
-- For this we use open dataset statement as OPEN DATASET <name> IN TEXT MODE FOR INPUT ENCODING NON-UNICODE. The file is read as a non-Unicode file. This avoids the dump but it uploads also the non Unicode data in the system. We need to analyse if this will cause any other effect on the system.
2. Upload file after removing the special characters
-- We need to upload the file again in the application server after removing the special characters in it.
3. Bypass the dump by displaying error message
-- By using OPEN DATASET........IGNORING CONVERSION ERROR, we can suppress the dump. Here the file is not read but only the dump is suppressed.
regards,
Gaurav -
Multiple file upload in jsp with out using �FILE� type filed.
I have an applet that is used for multiple file selection, It allows drag and drop functionality also. The problem is once the user selects multiple files it has to get uploaded to the server. Since it�s not part of a file type component while submitting the form we won�t get the file contents.
We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won�t come as part in the jsp submission and I can�t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .
Please give a solution�We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won’t come as part in the jsp submission and I can’t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .Well i think thats a wrong notion which you have...
you can very well get non-file type field data & file item data from a multipart form.
Anyways,Letz checkout a simple example(refer to the below Code-snippet down below) which can do that task for us and it uses commons-fileupload & commons-io libraries.
FileUpload.jsp
==========
<form name="sampleForm" action="uploadAction" method="POST" enctype="multipart/form-data">
File Name 1: <input type="text" name="fileName1" size="5" /> <br/>
File: <input type="file" name="file1" id="file1" /> <br/>
File Name 2: <input type="text" name="fileName2" size="5" /> <br/>
File: <input type="file" name="file2" id="file2" /> <br/>
File Name 3: <input type="text" name="fileName3" size="5" /> <br/>
File: <input type="file" name="file3" id="file3"/> <br/>
File Name 4: <input type="text" name="fileName4" size="5" /> <br/>
File: <input type="file" name="file4" id="file4"/> <br/>
<input type="submit" value="upload"/>
</form>uploadAction method in (backingBean) :
==============================
public void uploadAction(HttpServletRequest request,HttpServletResponse response)throws Exception{
FileUploadUtils fuu = new FileUploadUtils(request);
Map<String,FileItem> fileFields = fuu.getFileFiledsMap();
Map<String,String> nonfileFields = fuu.getNonFileFiledsMap();
String fileName1 = nonfileFields.get("fileName1");
FileItem file1 = fileFields.get("file1");
byte file1ContentBuffer[] = file1.get();
String file1ContentType = file1.getContentType();
InputStream file1ins = file1.getInputStream();
file1.write(file1Name);
String fileName2 = nonfileFields.get("fileName2");
FileItem file2 = fileFields.get("file2");
byte file2ContentBuffer[] = file2.get();
String file2ContentType = file2.getContentType();
InputStream file2ins = file2.getInputStream();
file2.write(file2Name);
}FileUploadUtils.java:
===============
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import com.gehcsr.utils.dao.DbQueryUtils;
public class FileUploadUtils {
private Map<String,FileItem> fileItemMap = null;
private Map<String,String> nFileItemMap = null;
private HttpServletRequest request = null;
public FileUploadUtils(HttpServletRequest request)throws Exception{
this.request = request;
this.fileItemMap = new HashMap<String,FileItem>();
this.nFileItemMap = new HashMap<String,String>();
this.init();
private void init() throws Exception{
DiskFileUpload dfu = null;
List fileItems = null;
try{
dfu = new DiskFileUpload();
dfu.setSizeMax(1000000);
dfu.setSizeThreshold(4096);
dfu.setRepositoryPath(System.getProperty(java.io.tmpdir));
fileItems = dfu.parseRequest(this.request);
if(dfu.isMultipartContent && fileItems != null){
Iterator iter = fileItems.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
String fieldName = item.getFieldName();
if (!item.isFormField()){
String fieldValue = item.toString();
this.nFileItemMap.put(fieldName,fieldName);
}else
this.fileItemMap.put(fieldName,item);
}catch(Exception exp){
exp.printStackTrace();
System.err.println(exp.getMessage());
throw new Exception(exp.getCause());
} finally{
fileItems = null;
dfu = null;
public Map<String,FileItem> getFileFiledsMap(){
return this.getFileFiledsMap;
public Map<String,String> getNonFileFiledsMap(){
return this.nFileItemMap;
NOTE:* Do not forget to add latest versions of commons-fileupload.jar & commons-io.jar in your classpath.You might get few warings due some issues with regards to generics please neglect them.
and it is not certain that you ought to use commons libraries for this there are many other alternative solutions available by which you can implement a similar functionality.
Hope this might help !!! if that does do not forget to assign/share duke dollars which you have promised :)
REGARDS,
RaHuL -
Integration of BIP Report file bursting with Unix FTP directory(using IBot)
We have a requirement for dynamically creating the folder in FTP server, which gets the bursted file when a BIP report is executed.
We have used the following approach:
Created a IBot with Custom Java Program which creates a folder dynamically in FTP, now we are facing the problem to integrate this IBot with the BIP report file bursting.
Can anyone suggest how to overcome this issue or is there any alternative approach to achieve the above requirement.
Any help would be appreciated..
-
Fileaccess.HttpUploadBean not uploading file in DataBase Table
Hi,
I am using fileaccess.HttpUploadBean to upload the txt file in the specified database table.i have followed all the guidelines given in Oracle JSP Tag Libraries and Utilities Reference Guide. But i am not be able to upload the file into Database Table
I have created a table
CREATE TABLE FLK_CLOB_TEST (
FILE_ID NUMBER (5),
FILE_DATA CLOB,
FILE_NAME VARCHAR2 (50),
FILE_PREFIX VARCHAR2 (50) ) ;
uploadfile.jsp
<html><body>
<form name = "formname" action="beanUploadDataBase.jsp" method=POST ENCTYPE="multipart/form-data" />
<br>MailID: <INPUT TYPE="text" NAME="strMailId" />
<br> File to upload: <INPUT TYPE="FILE" NAME="File" SIZE="50" MAXLENGTH="120" >
<br><INPUT TYPE="Submit" NAME="Submit" VALUE="Send" >
<INPUT type="reset" name="reset" value = "Cancel">
</form>
</body></html>
beanUploadDataBase.jsp , which is having upload code.
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page language="java"
import="java.util.*,java.io.*,java.sql.*, oracle.jsp.webutil.fileaccess.*" %>
<html><body>
<Form name="upForm" method ="post" > <!--action ="beanUploadExample.jsp" >-->
<%
Connection conn;
FlkOracleDBCon objDBHelper;
objDBHelper = FlkOracleDBCon.getInstance();
String userdir = "test";
String strFlag = "";
String strFileName ="";
String strDirName ="";
String strAbsoluteName ="";
//MultipartRequest multi = null;
String _PageMode = "";//"CREATE";
%>
<jsp:useBean id="upbean"
class="oracle.jsp.webutil.fileaccess.HttpUploadBean" >
<jsp:setProperty name="upbean" property="destination" value="<%=userdir%>"/>
</jsp:useBean>
<%
try{
conn = objDBHelper.getConnection();
out.println("Connection Value is :"+conn);
if (conn !=null)
// upbean.setDestination("test");
upbean.setDestinationType("database");
upbean.setConnection(conn);
upbean.setOverwrite(false);
upbean.setFileType("character");
upbean.setTable("FLK_CLOB_TEST");
upbean.setPrefixColumn("File_Prefix");
upbean.setFileNameColumn("File_Name");
upbean.setDataColumn("File_Data");
//upbean.setBaseDir(application, request);
String str = upbean.getDestination();
out.println("The value of Destination is "+str) ;
upbean.upload(request);
String filename = upbean.getFileNameColumn();
String strTable = upbean.getTable();
String strPrefix = upbean.getPrefixColumn();
String name = "";
conn.commit();
out.println("filename-----:::::: "+filename+":::");
out.println("File Prefix-----:::::: "+strPrefix+":::");
out.println("DataBase Table Name-----:::::: "+strTable+":::");
Enumeration fileNames = upbean.getFileNames();
while (fileNames.hasMoreElements()) {
strFlag = "true";
strFileName = (String)fileNames.nextElement();
out.println("strFileName File Name Is:::::"+strFileName);
strAbsoluteName = strFileName.substring(4,strFileName.length());
catch(IOException ex)
out.println("IOException is =="+ex.toString());
catch(SQLException ex)
out.println("IOException is =="+ex.toString());
catch(Exception ex)
out.println("IOException is =="+ex.toString());
%>
This is not uploading file or any other information into database table called FLK_CLOB_TEST.
Please help me on this.I get the same error when i try to load the same data but from Oracle Table
11872 12108 RUN-050406 11/14/2011 4:38:44 PM Data flow <DF_TB_Generalità> received a bad system message. Message text from the child process is
11872 12108 RUN-050406 11/14/2011 4:38:44 PM
< ==========================================================
when i load data from SAP extractors or SAP tables i don't have problem.
Regards
Bilal -
IMP:ClassCastException while using File upload UI in Webdynpro for java
Hi All,
I have used a FileUpload UI element in my screen , which is working fine for only the first time we upload a file. If we try to upload any file with out refreshing the application , a ClassCastException is being thrown. Please help me in resolving the issue.
Thanks in advance.
SrikanthThank you!!
1. But when i use the File Upload UI and try to use the 'data' property to retrieve the bytes i am getting a null pointer exception meaning the data is not being picked up by the UI even though browsed file has data.
2. How I am I supposed to set the 'Resource' property while downloading a PDF which has UTF-16 text and picture??
Note: I have done the same scenario using WD04 java without any trouble.
reg
vln -
File upload with non-ascii name
I'm designing a system that includes file-uploads. My problem is that any non-ascii chars in the filename are encoded strangely when saved. ä is encoded to å etc.
I use Tomcat with the -Dfile.encoding="UTF-8" in the Catalina file. I get the same result despite method; my own implementation, apache commons or Javazoom's uploadBean. All the JSP charset parameters are set.
Any ideas?Hi amitads,
I'm sure u've used Java enough. Also, u must have learned about the \ (backslash) escape character ?
So, if u want to include a string like a single quote, u can write \' and for a double quote u can write \".
Try this ... I'm sure it will help.
Keep me posted.
Cheers !!
Sherbir. -
File Upload in to application Server
How can we upload all the files from a Normal folder(not a ZIP folder) to SAP Directories .
Can we do this from File upload UI.The problem i m facing with File Upload UI is it does not allow u to select the main folder , it opens up the folder to select a file available in it .
I want help on how to select a complete folder in the file upload UI.or i have to use some other UI.Hi Dear,
U have to use File upload UI element , then read the file then follow the code for transfering into SAP directories:
check this
*Declare T_UPLOAD , W_UPLOAD itab and wa with your file heading structure
DATA:L_LINE TYPE STRING.
P_FLNAME = 'Test123'. " file name
OPEN DATASET P_FLNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CHECK SY-SUBRC = 0.
LOOP AT T_UPLOAD INTO W_UPLOAD.
CONCATENATE W_UPLOAD-Field1
W_UPLOAD-Field2
W_UPLOAD-Field3
W_UPLOAD-Field4
W_UPLOAD-Field5
INTO L_LINE
SEPARATED BY ','.
TRANSFER L_LINE TO P_FLNAME.
ENDLOOP.
CLOSE DATASET P_FLNAME.
I think it may help u a lot..
Regards
Aisurya -
File upload and download through web Dynpro2.0.9. with Java
Hai All,
I am working in web Dynpro2.0.9 with Java.For file upload and download "IWDResource" is used.But this package is not available in web Dynpro2.0.9.How to download and upload files through using this version?
Anyone can help me?
Thanks in Advance,
Kindly Regards,
S.V.Selva Bala.Hai Noufal,
I successfully upload the files to the database.
For file download i create two views.
In the first view files are fetched from the database(datatype for the file is image in the database)and it is converted to byte from image.Afterthat the byte is converted to string by using the following code.
byte source[]=new byte[1024];
if(rs.next()){
source=rs.getBytes("cv_document_file");
String sourcestr=source.toString();
wdContext.currentContextElement().setDownloadfile(sourcestr);
Now i put the converted string into the second view.In the second view i try to convert the string value into bytes by using the following codes.
String sourcestr=wdContext.currentContextElement().getDownloadfile();
byte bs[]=new byte[1024];
bs=sourcestr.getBytes();
wdContext.currentDownloadElement().setDownloadfile(bs);
But it doesn't work and no error.
Now i am expecting the valuable suggestions from you.
Thanks in Advance,
Kind Regards,
S.V.Selva Bala. -
Program to download on Non Unix Server location using SFTP
Hi,
What commands/function modules can use for download the file on Non Unix Server location using SFTP.
Thanks,
FractPlease check Walters reply in the foloowing thread
a® -
File upload using apache Commons FileUpload problem
Hi All,
I have used Commons FileUpload for uploading files from windows to unix machine. I'm able to upload files but I have a problem about the contents of file copied in unix. When i upload files few files containing special characters are not copied correctly in unix instead ascii codes are getting copied/written. Seems to be a problem with character encoding.
For example symbol "�" is not getting copied correctly in unix. So as new line character to. If anyone has faced such issues kindly provide few pointers on this. Appreciate your guidance.
Thanks,
-AjThanks for the reply.
I'm using the Commons FileUpload class "FileItem" which holds the filestream data and using function
code snippet of file upload
ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
List fileItemsList = servletFileUpload.parseRequest(request);
Iterator it = fileItemsList.iterator();
while (it.hasNext())
FileItem fileItemTemp = (FileItem)it.next();
File saveToFile = new File("newFile");
fileItem.write(saveToFile ); // write fileItem data to saveToFile.
} FileItem object takes care of writing data to disk.No idea,how it does internally.
Thanks,
-Aj. -
How to upload an rtf file into a table? (without using UNIX box)
Hi All,
Our requirement is to upload a rtf file into table in database.
Later that rtf is used to generate a report.
Is it possible to upload the file directly into a table by using SQL developer?
our requirement is to upload the files without placing them in a particular path in unix box.
Thanks in advance
Regards
SudeepIf you are in EBS
When you upload Template in Application
I guess It'll get stored in apps.XDO_LOBS table, in FILE_DATA Column
select * from apps.XDO_LOBS
where lob_code=<'con. program short name'>
and file_name= <'your.rtf'>
Thanx
Rahul
Maybe you are looking for
-
How to send the dynamically generated XML file to other site for further processing?
I have a question regarding exchanging data between two systems using XSQL servlet. The situation is descrbed as the follows: Assume that we have a simple XSQL page named "emp.xsql" <?xml version="1.0"?> <?-- XSQL page file "emp.xsql" --> <xsql:query
-
PowerShell - List all users that have access to a particular SPLIstItem
Hi there, In PowerShell - how to list all users that have access to a particular SPLIstItem? Thanks so much in advance.
-
EXS24 sample library won't link to Logic Express
Please help me as its starting to wreck my swede. I have a library of samples on my macbook that have been transfered from my desktop but I can't get to open them in logic. Any suggestions would be great!
-
My very elderly parents have been charged 200 pounds to have an extension fitted because they are disabled and cannot get down the stairs in time to answer the phone. Is this a fair price. If they had not been worried about asking me, (in case I ha
-
Flash CS4 Alpha Motion Fade Not Working In flashplayers 10
Hi, I have a basic alpha motion fade which works using my flashplayer but not in flash players less than version 10 (no fade is present its just instantly there). If I change the player I am developing for in my movie settings the fade just does not