Unicode: File upload
Hello,
I want to upload a flat file (*.txt, encoding UTF-8) containing text fields with a length of 110 characters to a PSA table in a Unicode system. In case the field entry only consists of Unicode characters (in my example Kanji or Kana) the PSA entry is cut off at a length of 42 characters. Are the entries a mix of Unicode and non-Unicode characters the number of the inserted characters is variable. I found the OSS Note 941642 and added Dummy fields to the transfer structure. Furthermore I try read the flat file using an APD. In both cases I got the same result (only 42 characters).
Is there a restriction to single fields in the PSA table or does anyone know what to do to load the complete 110 Kanji characters into the PSA table?
Thank you and best regards.
Tanja
Hello Thomas,
I know that the maximum lenght of an InfoObject is 60 characters. Therefore I want to split up the field (110 characters) in the transfer rules and upload it into two InfoObjects (60 and 50 characters) of a DSO. This works for ASCII characters, but fields with Kanji characters seem to have a maximum lenght of 42 characters.
Any idea?
Thank you. Tanja
Similar Messages
-
Upload unicode file and display content in a textarea
Hi all,
I am trying to do the following;
1. upload a unicode file (file with some non-english characters)
2. after uploading, read the uploaded file and show the content in a textarea in a jsp page.
I use struts in my project. I use class org.apache.struts.upload.FormFile for uploading the file. The upload works fine. I do the upload with help of FormFile's getInputStream method. When i read and display the content in the textarea, the content is displayed junk. But i tried to open the uploaded file, its fine. I mean it is just as my source file. Please help me out for reading the uploaded unicode and displayed in a textarea.
Below is the code that i use to upload the file;
File tempFile = null;
FileOutputStream fos = null;
InputStream is = null;
try {
tempFile = "c:/ThaiText.txt";
fos = new FileOutputStream(tempFile);
is = theFile.getInputStream();
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) {
fos.write(buf, 0, len);
logger.info("fileName$$=" + tempFile.getName());
} catch (Exception e) {
logger.error(e);
throw e;
} finally {
closeOutputStream(fos);
}Below is the code that i use for reading the uploaded file's content and store it to a string. I set this string to a form bean's string property.
public static String readContentNonUTF8(String path) {
FileInputStream fis = null;
String value = "";
try {
fis = new FileInputStream(path);
byte[] buf = new byte[1024];
int len;
while ((len = fis.read(buf)) > 0) {
String tmp = new String(buf, 0, len);
value = value.concat(new String(tmp.getBytes()));
} catch (Exception e) {
logger.error(e);
} finally {
try {
fis.close();
} catch (Exception e) {
return value;
}Hi,
Thanks for your reply. You meant that both method also can used to upload file and submit data? How about if i want to use the first method to upload file and submit data? How can i upload the file by using first method? -
HELP! File Upload Servlet and Internet Explorer
Hello people. I hope this is an easy problem to solve...
I have a servlet upload program that works using Mozilla browser (www.mozilla.org), but for some reason it doesn't work using Microsoft IE. The servlet is also using the servlet upload API from Apache (commons).
I'm using IE version 6.0.2800.1106 in a Win98SE host computer. I get a cannot find path specified error message (see below). At work, I also get the same error message using IE, but don't know what version. The OS is XP. Unfortunately, at work, I can't install Mozilla browser (or any software-company policy) to see if Mozilla works there too. I would've like to have tested to see if the upload program worked on Mozilla on a truly remote computer.
So I figured, it must be a IE configuration issue, but darn it!! I began by resetting IE to default settings, but still have the problem, I played around with several different combinations of settings in "Tools"-->"Internet Options...", and I still get the error message. Someone PLEASE HELP ME!!!
Dunno, if it will help, I've also pasted the upload servlet source code below and the html file that's calling the upload servlet, but you still need the Apache commons file upload API.
Trust me on this one folks, for some reason it works for Mozilla, but not for IE. With IE, I can at least access web server, and therefore, the html file that calls the upload servlet , so I don't think it's a Tomcat configuration issue (version 5.0). I actually got the code for the file upload servlet from a book relatively new in the market (printed in 2003), and it didn't mention any limitations as far as what browser to use or any browser configuration requirements. I have e-mailed the authors, but they probably get a ton of e-mails...
Anyone suggestions?
Meanwhile, I will try to install other free browsers and see if the file upload program works for them too.
ERROR MESSAGE:
"HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: C:\TOMCAT\webapps\MyWebApps\files\C:\WINDOWS\Desktop\myfile.zip (The system cannot find the path specified)
com.jspbook.FileUploadCommons.doPost(FileUploadCommons.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
java.io.FileNotFoundException: C:\TOMCAT\webapps\MyWebApp\files\C:\WINDOWS\Desktop\myfile.zip (The system cannot find the path specified)
java.io.FileOutputStream.open(Native Method)
java.io.FileOutputStream.(FileOutputStream.java:176)
java.io.FileOutputStream.(FileOutputStream.java:131)
org.apache.commons.fileupload.DefaultFileItem.write(DefaultFileItem.java:392)
com.jspbook.FileUploadCommons.doPost(FileUploadCommons.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
Apache Tomcat 5.0.16"
FILE UPLOAD SERVLET source code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import java.util.*;
public class FileUploadCommons extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.print("File upload success. <a href=\"/MyWebApp/files/");
out.print("\">Click here to browse through all uploaded ");
out.println("files.</a><br>");
ServletContext sc = getServletContext();
String path = sc.getRealPath("/files");
org.apache.commons.fileupload.DiskFileUpload fu = new
org.apache.commons.fileupload.DiskFileUpload();
fu.setSizeMax(-1);
fu.setRepositoryPath(path);
try {
List l = fu.parseRequest(request);
Iterator i = l.iterator();
while (i.hasNext()) {
FileItem fi = (FileItem)i.next();
fi.write(new File(path, fi.getName()));
catch (Exception e) {
throw new ServletException(e);
out.println("</html>");
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
doPost(request, response);
HTML PAGE that calls the upload servlet:
<html>
<head>
<title>Example HTML Form</title>
</head>
<body>
<p>Select a file to upload or browse
currently uploaded files.</p>
<form action="http://##.##.##.####/MyWebApp/FileUploadCommons"
method="post" enctype="multipart/form-data">
File: <input type="file" name="file"><br>
<input value="Upload File" type="submit">
</form>
</body>
</html>
Thanks in advance for any assistance.
-DanI'm guessing what is happening is that Mozilla tells the servlet "here comes the file myfile.zip". The servlet builds a file name for it:
String path = sc.getRealPath("/files");
// path is now C:\TOMCAT\webapps\MyWebApps\files\
fi.write(new File(path, fi.getName()));
// append myfile.zip to "path", making it C:\TOMCAT\webapps\MyWebApps\files\myfile.zipIE, however, tells "here comes the file C:\WINDOWS\Desktop\myfile.zip". Now imagine what the path+filename ends up being...
So what you want to do is something along the lines of (assuming Windoze):
public static String basename(String filename)
int slash = filename.lastIndexOf("\\");
if (slash != -1)
filename = filename.substring(slash + 1);
// I think Windows doesn't like /'s either
int slash = filename.lastIndexOf("/");
if (slash != -1)
filename = filename.substring(slash + 1);
// In case the name is C:foo.txt
int slash = filename.lastIndexOf(":");
if (slash != -1)
filename = filename.substring(slash + 1);
return filename;
fi.write(new File(path, basename(fi.getName()));
....You can make the file name check more bomb proof if security is an issue. Long file names trying to overflow something in the OS, NUL characters, Unicode, forbidden names in Windos (con, nul, ...), missing file name, ... -
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 -
Special characters being read from the unicode file for greek language
Hi All,
I have a report which would upload a unicode file and then update the vendor master data accordingly.
The file contains greek characters too.
when the file is being read in the code, some special characters are being added up to the vendor number which is the first entry. The special characters are not included in the file , but are added up only to the first vendor number and not any other vendor numbers.
The logic that is being used is as follows :
TRY.
IF unicode IS INITIAL.
IF codepage IS INITIAL.
*--> For backward compatibility where this FM might be called from
* other dependent objects (FMs/dynamic subroutines)
* which donot have access to user's input w.r.t Unicode parameters
OPEN DATASET filename FOR INPUT
IN LEGACY TEXT MODE
MESSAGE msg
REPLACEMENT CHARACTER repl_char
IGNORING CONVERSION ERRORS
FILTER filter.
ELSE.
*--> System in non-unicode and Unicode Environment (Phases I and II)
OPEN DATASET filename FOR INPUT
IN LEGACY TEXT MODE CODE PAGE codepage MESSAGE msg
REPLACEMENT CHARACTER repl_char
IGNORING CONVERSION ERRORS
FILTER filter.
ENDIF.
ELSE.
*--> Extract File in Unicode format - Phase III
OPEN DATASET filename FOR INPUT IN TEXT MODE ENCODING UTF-8
MESSAGE msg
FILTER filter.
ENDIF.
IF sy-subrc NE 0.
MESSAGE e001(zuni) WITH filename sy-subrc
RAISING file_open_error.
ENDIF.
the unicode parameters used are : codepage = 8000.
An early reply is most appreciated.
Regards,
Manu.Please check SAP notes for Eastern European Characters in Unicode system. and may be below code helps you
DATA:
ltp_bom TYPE sychar01,
ltp_encoding TYPE sychar01,
ltp_codepage TYPE cpcodepage.
Processing --------------------------------------------------------- *
TRY.
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = itp_filename
max_kb = -1
all_if_7bit_ascii = abap_true
IMPORTING
bom = ltp_bom
encoding = ltp_encoding.
CATCH cx_sy_file_open .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_open_error.
CATCH cx_sy_file_authority .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_authority_error.
CATCH cx_sy_file_io .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_io_error.
ENDTRY.
CASE ltp_encoding.
WHEN cl_abap_file_utilities=>encoding_utf8
OR cl_abap_file_utilities=>encoding_7bit_ascii.
CASE ltp_bom.
WHEN cl_abap_file_utilities=>no_bom.
OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
ENCODING UTF-8.
WHEN cl_abap_file_utilities=>bom_utf8.
OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
ENCODING UTF-8
SKIPPING BYTE-ORDER MARK.
WHEN cl_abap_file_utilities=>bom_utf16_be.
ltp_codepage = '4102'.
OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
BIG ENDIAN CODE PAGE ltp_codepage.
WHEN cl_abap_file_utilities=>bom_utf16_le.
ltp_codepage = '4103'.
OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
LITTLE ENDIAN CODE PAGE ltp_codepage.
WHEN OTHERS.
OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
ENCODING UTF-8.
ENDCASE.
WHEN OTHERS.
OPEN DATASET itp_filename FOR INPUT IN LEGACY TEXT MODE.
ENDCASE.
Edited by: Nilesh Shete on May 7, 2010 5:29 PM -
Unicode file formats ( open dataset)
Hi,
We are sending Unicode file with encoding as UTF-8( open dataset) containing Greek character to Legacy system. Legacy system( Sql server) is not able to understand this file format. As a workaround legacy side team coverts the file to Unicode UCS-2 using notepad ( by selecting encoding option as Unicode) and then uploading it to SQL server..
Is there anyway to convert the UTF-8 file to other Unicode file format ( say UCS-2 )within SAP or generate the desired file format.Hi Martin,
Thanks for the help!!!
I tried to convert the file format from UTF-8 to UCS-2 using the methods of the class mentioned but it didn't fulfill my requirement. I have Greek character in UTF-8 format and when I convert it to any other other format then Greek character are displayed as #.
Problem is legacy SQL server don't support UTF-8 format. I tried open data set with binary mode & also legacy text mode with all available code pages but result were not fruitful.
( Program RSCP_CONVERT_FILE to convert code page - I used target code page as all possible UTF* , UCD* & Greek code page but no luck ).
I am just wondering whether SAP can convert UTF-8 to UCS-2 or not. Other option I am thinking is to have the file converted by Unix script that is application server external command which can be executed via FTP. -
Problem in File Upload - URGENT
Hi All,
Advance thanks for your reply
My Query
we are not mention the clint-no in my flat file
During file upload its client no add to itab
i will mention code also
parameters: p_file type rlgrap-filename obligatory
DEFAULT 'c:\temp\pcard.dat'.
at selection-screen on value-request for p_file.
call function 'WS_FILENAME_GET'
exporting
mask = ',.,..'
importing
filename = p_file
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
call function 'WS_UPLOAD'
exporting
filename = p_file
filetype = 'DAT'
tables
data_tab = itAB
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
Please send the guide lines or code for my query
i look forwar to your reply
Regards
RajCheck this
Uploading files from PC(Presentation Server)
There are also a number of other function modules which could be used for uploading/downloding files
between SAP and the presentation server.
* Retrieve data file from presentation server(Upload from PC)
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = i_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
*& Report ZUPLOADTAB *
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
name1(10) TYPE c,
name2(15) TYPE c,
age(5) TYPE c,
END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) TYPE c.
CONSTANTS: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
* con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION <b>'WS_FILENAME_GET'</b>
EXPORTING
def_filename = p_infile
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_infile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION <b>'GUI_UPLOAD'</b>
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
* Alternative method, where by you split fields at each TAB after you
* have returned the data. No point unless you dont have access to
* GUI_UPLOAD but just included for information
* CALL FUNCTION 'GUI_UPLOAD'
* EXPORTING
* filename = gd_file
* filetype = 'ASC'
* TABLES
* data_tab = it_datatab "ITBL_IN_RECORD[]
* EXCEPTIONS
* file_open_error = 1
* OTHERS = 2.
* IF sy-subrc NE 0.
* ELSE.
* LOOP AT it_datatab.
* CLEAR: wa_string, wa_uploadtxt.
* wa_string = it_datatab.
* SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
* wa_uploadtxt-name2
* wa_uploadtxt-age.
* MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
* APPEND wa_record TO it_record.
* ENDLOOP.
* ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
* Display report data for illustration purposes
LOOP AT it_record INTO wa_record.
WRITE:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
ENDLOOP.
http://www.sapdevelopment.co.uk/file/file_updown.htm
Hope this helps.
Kindly reward and close the thread. -
hi
we have the requirement to download data in excel file in unicode format for which the OLE FM EXCEL_OLE_STANDARD_DAT in used for the download.
We now want to upload the same file after modification. GUI_DOWNLOAD uplaods the file wsith gibberish characters. We tried using the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' but it gives the dump UPLOAD_OLE exception.
What else are the methods to upload the excel file.
Your ideas appreciated.
Rgds,
StckHi,
Try this code to upload the data from EXCEL sheet.
DATA l_count TYPE sy-tabix.
CONSTANTS: lc_begin_col TYPE i VALUE '1',
lc_begin_row TYPE i VALUE '2',
lc_end_col TYPE i VALUE '2',
lc_end_row TYPE i VALUE '3000'.
* Begin of CALK912848 - Carlos Werberich - 16Sep08
CLEAR p_i_excel_data. REFRESH p_i_excel_data.
* End of CALK912848 - Carlos Werberich - 16Sep08
* Function module to read excel file and convert it into internal table
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_p_file
i_begin_col = lc_begin_col
i_begin_row = lc_begin_row
i_end_col = lc_end_col
i_end_row = lc_end_row
TABLES
intern = i_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
* Error in file upload
IF sy-subrc NE 0 .
MESSAGE text-006 TYPE 'E'.
EXIT.
ENDIF.
IF i_data[] IS INITIAL .
MESSAGE text-007 TYPE 'E'.
EXIT.
ELSE.
SORT i_data BY row col .
* Loop to fill data in Internal Table
LOOP AT i_data .
MOVE i_data-col TO l_count .
ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO .
AT END OF row .
* Append data into internal table
APPEND p_i_excel_data.
CLEAR p_i_excel_data.
ENDAT .
ENDLOOP .
ENDIF -
I'm encountering this error and not sure how to fix, I'm quite new to vCenter so please bear with me.
I'm trying out vCenter 5.1 with Update Manager 5.1 right now. No license key has been entered and I still have 50 odd days to try it out.
2 ESXi hosts are being managed by this vCenter, and they're both running ESXi 4.0
I'm looking to use Update Manager to try to upgrade the ESXi 4.0 hosts to ESXi 5.1
I downloaded the image file VMware-VIMSetup-all-5.1.0-799735.iso from VMWare website, and is looking to import it using the Update Manager so I can update the ESXi hosts, but I keep on getting the error:
File name: VMware-VIMSetup-all-5.1.0-799735.iso
Failed to transfer data
Error was: A web exception has occurred during file upload
I tried importing it by using vSphere client to connect to vCenter server both remotely and locally, with firewall disabled.
I've read http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026602
I've disabled firewall, and there is no anti-virus program on the server. I've also restarted the machine several times, to no avail, I didn't reinstall update manager because the whole Windows and VCenter installations are clean from scratch.
I logged into the vSphere Client using Active Directory credentials, and I've made all Domain Admins (which my account is a member of) part of the administrator group on the vCenter server. I can't log in using admin@System-Domain because it tells me I don't have permissions for it, I still haven't really had the chance to figure out why that is and not sure if that makes a difference.
Also, I'm fairly certain I'm using the right image file, as I've burned some DVD's used that image file to upgrade some other ESXi hosts. Unless there's a special image file I need to download?
I'm at lost on what I can do to make it work. Please advise.
Thanks.The ISO file you mentioned is the one for vCenter Server. What you need is the "VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso" (or VMware-VMvisor-Installer-201210001-838463.x86_64.iso) for the ESXi host.
André -
1. when use com.oreilly.servlet.MultipartRequest to handle the file upload, can I change the upload file name .
2. how com.oreilly.servlet.MultipartReques handle file upload? do it change to byte ?
what different? if I use the following method?
File uploadedFile = (File) mp.getFile("filename");
FileOutputStream fos = new FileOutputStream(filename);
byte[] uploadedFileBuf = new byte[(int) uploadedFile.length()];
fos.write(data);
fos.close();My questions are
1) when use oreilly package to do file upload , it looks like i line of code is enough to store the upload file in the
file direction.
MultipartRequest multi =
new MultipartRequest(request, dirName, 10*1024*1024); // 10MB
why some example still use FileOutputStream?
outs = new FileOutputStream(UPLOADDIR+fileName);
filePart.writeTo(outs);
outs.flush();
outs.close();
2) can I rename the file name when I use oreilly package? -
BI IP --- Planning function for File Upload
Hai All,
In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
In Text file I am using Tab Separation for each value
Anyone help me out.
Thanks,
BhimaHi Bhima
Try one of these; it should work:
1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
2. If not, then -
a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
Goodluck
Srikanth -
FILE UPLOAD PROBLEM SHOWING THE CONTENTS IN THE SAME BROWSER WINDOW
Hi,
This is amit Joshi
I have uploaded content using input tag of type file and posted to jsp as multipart/form-data type
in that jsp i am using following code to display the content in browser but only first content is displayed How can i modify it to show all content in the file ..
<html>
<head>
<title>File Upload Display</title>
</head>
<body>
<%
//ServletOutputStream sout=response.getOutputStream();
StringBuilder strBuilder = new StringBuilder();
int count=0;
String f;
f=request.getParameter("filedb");
DBManager dbm = new DBManager();
//dbm.createTable("mms3");
//log.info("In JSP : "+ f);
//dbm.insert_data(f,"mms3");
%>
<%
if (ServletFileUpload.isMultipartContent(request)){
ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
List fileItemsList = servletFileUpload.parseRequest(request);
strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
String optionalFileName = "";
FileItem fileItem = null;
Iterator it = fileItemsList.iterator();
ServletOutputStream outputStream=null;
while (it.hasNext()){
FileItem fileItemTemp = (FileItem)it.next();
if (fileItemTemp.isFormField()){
%>
<b>Name-value Pair Info:</b>
Field name: <%= fileItemTemp.getFieldName() %>
Field value: <%= fileItemTemp.getString() %>
<%
if (fileItemTemp.getFieldName().equals("filename"))
optionalFileName = fileItemTemp.getString();
else
fileItem = fileItemTemp;
if (fileItem!=null){
String fileName = fileItem.getName();
%>
<b>Uploaded File Info:</b>
Content type: <%= fileItem.getContentType() %>
Field name: <%= fileItem.getFieldName() %>
File name: <%= fileName %>
<%
if(fileItem.getContentType().equals("image/jpeg")) { %>
File : <p><%
//response.setContentType("image/gif");
byte[] bArray=fileItem.get();
response.setContentType("image/jpeg");
outputStream=null;
outputStream= response.getOutputStream();
outputStream.write(bArray);
outputStream.flush();
outputStream.close();
else if(fileItem.getContentType().equals("text/plain"))
%> File : <%= fileItem.getString() %>
<%
byte[] bArray=fileItem.get();
response.setContentType("text/plain");
outputStream = response.getOutputStream();
out.println();
outputStream.write(bArray);
outputStream.flush();
outputStream.close();
%> </p> <%
%>
</body>
</html>
Edited by: Amit_Joshi on Nov 13, 2007 10:58 PMWell Well Well..
That would not work...
What you have to do is save the uploaded file content on to a location and then pass the fileName as a request parameter to a deidicated which displays the contents of that file.
Just as an example
<html>
<head>
<title>File Upload Display</title>
</head>
<body>
<%
//ServletOutputStream sout=response.getOutputStream();
StringBuilder strBuilder = new StringBuilder();
int count=0;
String f;
f=request.getParameter("filedb");
DBManager dbm = new DBManager();
//dbm.createTable("mms3");
//log.info("In JSP : "+ f);
//dbm.insert_data(f,"mms3");
%>
<%
if (ServletFileUpload.isMultipartContent(request)){
ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
List fileItemsList = servletFileUpload.parseRequest(request);
strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
String optionalFileName = "";
FileItem fileItem = null;
Iterator it = fileItemsList.iterator();
ServletOutputStream outputStream=null;
while (it.hasNext()){
FileItem fileItemTemp = (FileItem)it.next();
%>
Name-value Pair Info:
Field name: <%= fileItemTemp.getFieldName() %><br/>
Field value: <%= fileItemTemp.getString() %><br/>
<%
if (fileItemTemp.getFieldName().equals("filename"))
optionalFileName = fileItemTemp.getString();
if(!fileTempItem.isFormFiled()){
String fileName = fileItem.getName();
fileItem.write(optionalFileName);
%>
Uploaded File Info:
Content type: <%= fileItem.getContentType() %><br/>
Field name: <%= fileItem.getFieldName() %><br/>
File name: <%= fileName %><br/>
<%
if(fileItem.getContentType().equals("image/jpeg") || fileItem.getContentType().equals("image/pjeg")) {
%>
<img src="FileServlet?fileName=<%=optionalFileName%>"
<%
%>
</body>
</html>a sample code snippet for FileServlet.
String fileName = request.getParameter(fileName);
File file = new File(fileName);
if(!file.exists())
return;
// If JSP
String mimeType = application.getMimeType("fileName");
If you are using servlet
String mimeType = this.getServletContext().getMimeType(fileName);
response.setContentType(mimeType);
response.setHeader("Content-Disposition","inline;filename=\\"+fileName+"\\");
BufferedOutputStream out1 = null;
InputStream in = null;
if(mimeType == null)
mimeType = "application/octet-stream";
try{
in = new FileInputStream(f);
response.setContentLength(in.available());
BufferedOutputStream out1 = new BufferedOutputStream(response.getOutputStream(),1024);
int size = 0;
byte[] b = new byte[1024];
while ((size = in.read(b, 0, 1024)) > 0)
out1.write(b, 0, size);
}catch(Exception exp){
}finally{
if(out1 != null){
try{
out1.flush();
out1.close();
}catch(Exception e){}
if(in != null){
try{in.close();}catch(Exception e){}
} Hope that might answer your question :)
However,this is not the recommended way of doing this make use of MVC pattern.Would be a better approach.
you might think of googling on this and can findout what is the best practise followed for problems of this sort
REGARDS,
RaHuL -
Unable to get the filename from file upload UI element
Hi,
I added a FileUpload UI element.
I created an attribute of type resource , assigned to the resource property of the file upload element.
I created an action button called upload and added the following code.
try {
IWDResource resource = wdContext.currentContextElement().getFileupload();
} catch (Exception e) {
e.printStackTrace();
when I debug to see the value of resource it is null.
Please let me know where I am going wrong.
Regards,
NarayaniHi,
Check if there are any space characters in your uploading path (file path).
First try to upload a file without any space characters in the uploading path(file path). If the problem is with the space characters then use the below encoding & decoding to resolve that issue.
Encoding while uploading the file:
// Getting the file resource
IWDResource resource = element.getCtx_va_FileResource();
//Getting the resource name
String resourceName = resource.getResourceName();
//Encoding the resource name
String encoderesourceName = java.net.URLEncoder.encode(resourceName,"UTF-8");
Again while downloading you can use decoder.
Hope this helps to resolve your issue.
See this below link.
Re: File Upload Problem
Try this encoding even if there are no space characters.
Regards,
Charan -
File Upload UI element is not working properly inside Table Popin container
Hi Expert,
I created a table with popin, i placed file-upload UI element inside table popin contatiner.
The file upload UI element is displaying properly but, when i click the browse button to select the file, the file open dialog box is not popping out.
will table popin support file-upload UI element inside it?
it not is there any other way to call a file_open dialog box from inside the table popin.
Thanks,
JamesIf you are on NetWeaver 7.01, you can try both the ACFUpDownload UI element or try creating your own FileUpload in Adobe Flex with Flash Islands. ACFUpDownload requires the KPRO by default (which is why the same application isn't working for you), but you can write your own handler class to act as the KPRO receiver. Here is an eLearning on the topic:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04
and source code:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70645070-bb00-2c10-f086-f126721acdb4
If you want an eLearning on the FlashIslands approach, you can find it here as well:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50d42644-91ef-2b10-228c-9e0ae75b274e
and Source Code:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f044b62c-90ef-2b10-64a6-9ec25294d133
However in both of these approaches you still have to be careful with how you handle large files. The problem is that they are processed often a single binary string. This makes the processing easy, but requires total amount of session memory at least as large as the file being uploaded. In NetWeaver 7.02 ABAP adds the concept of Streams and Locators to help with the partial processing of large files. This feature doesn't come until later this year, but if you are interested you can learn about it here:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80f983df-213e-2c10-ba89-b5a12ef178e8 -
File Upload applet not opening in Query Mode
File Upload Applet is opening in Query Mode in Siebel 7.5, where as in Siebel 7.8 its not opening in Query Mode.
Should anything be changed in CFG? or siebel restricted this?Hi,
There is a property called "Auto Query Mode" in the applet. Check whether this has been set to "New Query" in 7.5. If so the applet will be opening in Query Mode automatically. If this property is blank, in 7.8, the applet will not be opening in Query mode. Check and let me know.
Regards,
Joseph
Maybe you are looking for
-
(Using WiFi and all-- library computers, etc.. I got in the habit of keeping multiple tabs open. I came to Firefox because it handled that usage much, much better than any version of IE. Running the multiple tabs of the future television listings mad
-
Problem in Importing to MDS schema
Hello, I am creating a pre process event handler in OIM 11gR2,in which there is one step "*importing custom event into MDS schema*" to do that: 1)go to OIM_HOME/server/bin and edit the weblogic.props file as follows: wls_servername=oim_server1 applic
-
Where is the pictures folder in finder?
I have a macbook air OS X 10.9.5. When I tried to scan a document the destination folder was Pictures but it was greyed out. I then had to send the scan to iPhotos in order to send it on by email. There isn't a Pictures folder when I look in Finder
-
WAD 3.x not working with OS Windows 7
Dear Experts, We are using BI 7.0 with ABAP Services. Hence using BEx WAD 3.x version for Templates instead of WAD 7.x. On my PC, OS is Windows 7. While opening WAD 3.x it is giving message that "This application requires Internet Explorer 5 or highe
-
Problem in netweaver2004 installation
hi all while installing sap netweaver2004 i am getting following error "Output of C:\usr\sap\DPI\SYS\exe\uc\NTI386\R3load.exe -testconnect is written to the logfile R3load.exe.log. WARNING 2007-12-19 13:44:03 Execution of the command "C:\usr\sap\DPI\