Uploading/downloading a file to database
Hello friends,
I have created a page into which there is a button names "Upload Resume".
The idea is when an HR person clicks this button it should fetch out the resume
from his local machine and it save resume into the database.
My doubts are as follow:-
1. Where does the resume get stored in database or at the unix box
2. What we can do to download the same resume.
Please guide me.
Waiting for your responses.
Regards,
Pankaj Kedia
user12055837 wrote:
Hi,
The code that you have referred to me is a lot different than what I currently have. For example in the code it seems like you have the following statements(below) in the Process Request of Controller, But I have it in the AMImpl. Please let me know where these should be.Off course you can have the code in the AM as well.
>
OAApplicationModule ap = pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)ap.findViewObject("FndLobsVO");
if (!vo.isPreparedForExecution())
vo.executeQuery();
Row row = vo.createRow();
vo.insertRow(row);
Also I have my BLOB in the same view object as other data(LacEmpExposureVO) which refers to a custom table. I am NOT storing them in the FND_LOBS.
Do I need 2 columns one for storing the "uploaded file name" of type varchar2 and the other of type BLOB for the "uploaded file"
Yes it is the same as in FND_LOBS, i have a column FILE_NAME that contains the name (varchar2) of the uploaded file.
The OAMessageFileUploadBean View Attribute points to the BLOB column, called FILE_DATA (in the case of FND_LOBS).
Either ways it is not working as expected.
I modified the code like this and it is not erroring now, But not saving the file name either. When I display the column on the search page then it is displaying the contents of the BLOB column (UploadDataBlob) taking up the entire page instead of displaying it as a hyper link with the file name.
// get a handle to the uploadbean. the column UploadDataBlob is of type BLOB
OAMessageFileUploadBean uploadBean = (OAMessageFileUploadBean)webBean.findChildRecursive("UploadDataBlob");
// set file name display in the column UploadDataBlobFilename of type varchar2
OADataBoundValueViewObject displayNameBoundValue = new OADataBoundValueViewObject(uploadBean, "UploadDataBlobFilename");
uploadBean.setAttributeValue(DOWNLOAD_FILE_NAME,displayNameBoundValue);
In the code above if I change the following statement:
OADataBoundValueViewObject displayNameBoundValue = new OADataBoundValueViewObject(uploadBean, "UploadDataBlobFilename");
TO
OADataBoundValueViewObject displayNameBoundValue = new OADataBoundValueViewObject(uploadBean, "UploadDataBlob");
I get the following error:
UploadDataBlob - JBO-25009: Cannot create an object of type:oracle.jbo.domain.BlobDomain with value:F1606_ApplicantFlowLog.pdf
You cannot assign the BLOB column this way, because the OADataBoundValueViewObject is only used to get the UploadBean to display the uploaded file name, that is why i assign the FileName.
Why do you want to assign the BLOB column ?
Use this to assign the file name:
// set file name display
OADataBoundValueViewObject displayNameBoundValue = new OADataBoundValueViewObject(uploadBean, "FileName");
uploadBean.setAttributeValue(DOWNLOAD_FILE_NAME,displayNameBoundValue);
And for example this to assign MIME type (if you have this info in your table off course):
// set content type (MIME)
OADataBoundValueViewObject contentBoundValue = new OADataBoundValueViewObject(uploadBean, "FileContentType");
uploadBean.setAttributeValue(FILE_CONTENT_TYPE, contentBoundValue);
>
Any Help is greatly appreciated..
Thanks,
Mir
Similar Messages
-
ITS - upload/download of files - getting java error on download
Hi, I'm working on ITS to upload/download some files, really simple files in ASC and i use cl_gui_frontend_services=>gui_upload it works fine, and to download the cl_gui_frontend_services=>gui_download that in R/3 works but on the ITS give an error.
Any idea or someone that happend the same?
Thanks in advance to all
Regards
Jaimethere is a dedicated ITS forum at Internet Transaction Server (ITS)
search that forum, this has been discussed may times.
Raja -
How to download a file from database
Hi,
My flex application contains a form that uploads a file into the server. This file is however saved in the database, and not on the disk. Most of the tutorials in the database explains how to download a file by passing the file's url to the "download" function of the fileReference Object. That dsnt work for me as my file is saved in the database.
How do I download this file from the server ?
For example, in php, we would do smthing like this :
$content = $file_to_download['content'];
$size = $file_to_download['content_size'];
$type = $file_to_download['content_type'];
$name = $file_to_download['filename'];
header("Content-type:$type");
header("Content-length:$size");
header("Content-Disposition:attachment;filename=$name");
header("Content-Description:PHP Generated Data");
echo $content;
When executing this file, it opens up the "download file" dialog box. How do i get the same effect in flex 4 ?You need the bytes use FileReference.download() and after download you can save
it on disk with FileReference.save(); You also need FP 10 at least I think. Use
the docs they are less error pron than mi memory :).
C -
Downloading a file from Database [Blob field]
I am trying to write an application which can upload and download files [Excel, Word etc.] to/from an Oracle 9i database Blob field. I am using Java/JSP for the same.
The upload part works just fine. However, when I try to download the file that I uploaded, I get an error.
A dialog box comes up asking me to Open/Save the file. However, when I try to save it, it says
�Internet Explorer cannot download �..tion=download&planId= testplan from localhost
Internet Explorer was not able to open this Internet Site. The requested site is either unavailable or cannot be found. Please try again later.�
I am using IE 6.0. I tested the same with Firefox browser and was able to download the file.
Can anyone help?
Code:
Following is the code I am using for the same.
/* Code to retrieve from Blob field */
String sqlString = "SELECT PLAN_DOCUMENT_NAME,PLAN_DOCUMENT FROM BRS_PLAN_DESCRIPTION WHERE PLAN_ID = ?";
ps = con.prepareStatement(sqlString);
ps.setString (1,planId);
rs = ps.executeQuery();
while (rs.next()) {
fileBytes = rs.getBytes("PLAN_DOCUMENT");
fileName = rs.getString("PLAN_DOCUMENT_NAME");
brsPlanDocument.setPlanId(planId);
brsPlanDocument.setFileName(fileName);
brsPlanDocument.setFileBytes(fileBytes);
/* Code for download */
String fileName = brsPlanDocument.getFileName();
String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
if (fileType.trim().equalsIgnoreCase("txt"))
response.setContentType( "text/plain" );
else if (fileType.trim().equalsIgnoreCase("doc"))
response.setContentType( "application/msword" );
else if (fileType.trim().equalsIgnoreCase("xls"))
response.setContentType( "application/vnd.ms-excel" );
else if (fileType.trim().equalsIgnoreCase("pdf"))
response.setContentType( "application/pdf" );
else if (fileType.trim().equalsIgnoreCase("ppt"))
response.setContentType( "application/ppt" );
else
response.setContentType( "application/octet-stream" );
response.setHeader("Content-Disposition","attachment; filename=\""+fileName+"\"");
response.setHeader("cache-control", "no-cache");
byte[] fileBytes=brsPlanDocument.getFileBytes();
ServletOutputStream outs = response.getOutputStream();
outs.write(fileBytes);
outs.flush();
outs.close();Hi,
is this problem solved for you, I am also writing the java code to store different files in blob fields in database(db2udb) and allow users to open them through jsp pages. Upload seems to be working fine.....My big problem is only excel files are opened properly in both IE and Firefox. Word files, image files are not getting opened. Any suggestion as what I could be doing wrong....my jsp is kind of similar to the above one...
thanks in advace, please guide me
long pmsId = new Long(request.getParameter("pmsId")).longValue();
String fileName = request.getParameter("fileName");
int fileSeq = new Integer(request.getParameter("fileSeq")).intValue();
if(fileName.endsWith("txt")) {
response.setContentType("text/plain");
log.debug(" this is a text file");
} else if(fileName.endsWith("xls")) {
response.setContentType("application/vnd.ms-excel");
log.debug(" this is a excel file");
} else if(fileName.endsWith("gif")) {
response.setContentType("image/gif");
log.debug(" this is a image file");
} else if(fileName.endsWith("doc")) {
response.setContentType("application/msword");
log.debug(" this is a doc file");
} else if(fileName.endsWith("pdf")) {
response.setContentType("application/pdf");
log.debug(" this is a pdf file");
} else if(fileName.endsWith("ppt")) {
response.setContentType("application/ppt");
log.debug(" this is a ppt file");
} else {
response.setContentType("application/everythingelse");
log.debug(" this is a unknown ile");
response.setHeader("Content-Disposition", "attachment;filename="+fileName);
OutputStream out1 = response.getOutputStream();
Class.forName("com.ibm.db2.jcc.DB2Driver");
db2Conn = DriverManager.getConnection("jdbc:db2:TESTDB","db2admin","db2fv1000");
//log.debug("connection obtained");
pstmt = db2Conn.prepareStatement(" SELECT * FROM UPLOADDOCS WHERE PMSID = ? AND DOCSEQ = ? ");
//log.debug("statemenmt prepared");
pstmt.setLong(1, pmsId);
pstmt.setInt(2, fileSeq);
rs = pstmt.executeQuery();
int count = 0;
if(rs.next()){
InputStream is = rs.getBinaryStream("DOCUMENT"); //"is" is
//now the binary data
//of the file
byte[] buf = new byte[4096];
int len;
while ((len = is.read(buf)) > 0)
out1.write(buf, 0, len);
out1.close();
out1.flush(); -
Pls tell me how to upload from excel file to database.
hello,experts,
I want to upload data from excel local file to database table created by myself.when I use function
CALL FUNCTION 'GUI_DOWNLOAD'
the data in the internal table just become error code data that can not understand.
who can help me out?
thanks.Hi,
1st copy the values in XLS into internal table by using function Module:-
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = file_name<it is file path of u r XLS>
i_begin_col = 1
i_begin_row = 1
i_end_col = 250
i_end_row = 1
tables
intern = itab<this structure is same like u r database table>
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc 0.
then modify or insert these values to database from internal table:-
modify <DB table> from itab accepting duplicate keys.
for file popup use :
at selection-scree on <screen field>.
call function 'F4_FILENAME'
exporting
program = sy-cprog
dynnr = sy-dynnr
importing
filename = zfilename.
here zfilename of type rlgrap-filename.
and pass this as path in ASLA_EXCEL_TO_INTERNAL_TABLE
Edited by: vijay Mekala on Dec 29, 2007 12:45 PM -
FM to Upload/Download Word files
Hi Experts,
My requirement is i want to upload Ms-Word file in SAP through RFC, and after uploading the file i want to reterive that file through RFC.
Is there any standard FM to upload and download the file.
Regards,
Rajneesh GuptaHi use this
reward if help
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = BUFFER
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22 -
How to read and upload microsoft word file into database using forms9i
Hi,
How to read and upload microsoft word file into oracle database using forms9i. I appretiate if anyone can send me example or atleast a sujjetion.
Thanks in advance
Mahesh RagineniThe webutil package includes the ability up upload from the client to the database. See otn.oracle.com/products/forms and click on webutil for more details.
Regards
Grant Ronald
Forms Product Management -
Does iWeb support the uploading/downloading of files
I believe at one time, iWeb would support the upload and download of files from the mobileme account. I don't see anything like that in the templates. Am I correct in assuming it was there at one time and now it has disappeared?
It's still there.
This is how you do it.
Select something on your iWeb page you want to use as the hyperlink. (for example the words "link to file")
In the Link Inspector window check the box "enable as hyperlink" then select "Link to a file", then choose the file you want to link to. Publish, that's it. If you want the file to automatically open on the downloaders computer, then zip it first and select the zipped file to link to.
David -
Upload / download of files
Dear Friends,
I know that the question will probably be redundant to you
all but here it goes: how do I go about uploading a file for
download from my site. ( in this case a PDF ). I suspect that it
has to go in a ftp public folder but don't have a clue how to do it
and perhaps because of shortage of vocabulary on my part, can't
find it in the help files either.
Thank you in advanceHi Alan,
Thank you for such quick reply, it looks so simple that I'm a
bit confused: by 'Local Site folder' you mean the site folder on my
HD, right? And when uploading the pdf file, do I send it to the
public.html folder of the server along with the page(s)
itself?...I'm sorry I'm such a dumb A. but this is all news to me
and then there's the lingo that sometimes plays tricks on me too.
Thanks a lot
jvmonteiro -
ADF How to Download BLOB File from Database Column
Hi,
We have one blob Database Column in which we use for storing attachments(eg Image,.doc or.zip) . We are able to upload attachments.
How can I build page which will access that particular record and will be able to download attachment in it.
It should prompt to Save and then we can save it on Local machine.
Thanks,
JitSorry, I don't get your question.
If you have a file name including the suffix like 'Test.file.doc' you can pass this file name as parameter to the method and get the MIME type back. I your sample it would be "application/msword"
String mime = ContentTypes.get("Test.file.doc");
public class ContentTypes
public static String get(String fileName)
String mime = null;
String ext = fileName.toLowerCase();
if (ext.endsWith(".pdf"))
mime = "application/pdf";
else if (ext.endsWith(".doc"))
mime = "application/msword";
else if (ext.endsWith(".xls"))
mime = "application/msexcel";
else if (ext.endsWith(".docx"))
mime = "application/msword2007";
else if (ext.endsWith(".xlsx"))
mime = "application/msexcel2007";
else if (ext.endsWith(".ppt"))
mime = "application/vnd.ms-powerpoint";
else if (ext.endsWith(".rar"))
mime = "application/octet-stream";
else if (ext.endsWith(".zip"))
mime = "application/zip";
else if (ext.endsWith(".jpg"))
mime = "image/jpeg";
else if (ext.endsWith(".jpeg"))
mime = "image/jpeg";
else if (ext.endsWith(".gif"))
mime = "image/gif";
else if (ext.endsWith(".png"))
mime = "image/png";
return mime;
}Timo -
Uploading about 2GB file into database
Hello,
I want to upload a file of about 2GB size in the database. I am working on Struts framework and with Postgres8 and Oracle8i as database. When I try to upload it through my application it throws "Out of heap memory" error.
Can anyone help me out to solve the problem?
Thanks in advance.Don't attempt to handle the entire file in memory. Process the data a portion at a time.
-
Quick Question : Upload/Download text files
Hi,
can I use interMedia to upload text files on the Database. I don't need to query them for size or
whatever metadata but I'd like to retrieve them without any harm done :-)
I don't expect any problems but would still like to confirm.
Thanks,
SteveWhich interMedia object are you using to store the content?
No we don't do anyting to the content. You won't be able to use it easily within the database. You won't have any character set support. You will need to specify the mimetype yourself.
But it should work for raw storage and retrieval. -
Procurement Card data upload from flat file to database
Hi All,
I need to upload Procurement Card data from a flat file to the database in the table BBP_PCMAS.
I found a BAPI BAPI_PCARD_CREATEMULTIPLE which uploads the data perfectly, however the structure PCMASTER that it takes as input does not contain the field for Blocking reason PCBLOCK - Reason for blocking procurement card. I need to upload this file as well from the flat file.
Any suggestions?
ThanksHi,
You are correct the function module BAPI_PCARD_CREATEMULTIPLE does not contain the PCBLOCK field.
Alternatively what you can do is read the PC data after it is created and modify it with the PCBLOCK appropiately. The necessary function modules are given below.
BBP_PCMAS_READ_PCMAS - Read Data
BBP_PCMAS_MODIFY_PCMAS - Modify Data
Note: BBP_PCMAS_MODIFY_PCMAS is a Update Task FM. Hence it shoild be called as given below, ( refer form write_data of the FM BAPI_PCARD_CREATEMULTIPLE)
call function 'BBP_PCMAS_MODIFY_PCMAS' in update task
exporting
i_pcmas = i_pcmas
* I_PCMAS_OLD =
* I_DELETE =
tables
t_pcacc = i_pcacc
* T_PCACC_OLD =
exceptions
not_found = 1
others = 2.
Regards
Kathirvel -
How to upload a XML File in database
i use Blob type to set domain the Xml file. But i don't know use what class to define it.i only know use OrdHttpUploadFile to define a image. What class do i use to define a Xml file.
during my tries to adapt this code to my needs, following error occured during compilation of the procedure:
PLS-00201: identifier 'IMAGES.MIME_TYPE' must be declared
here is my procedure:
CREATE OR REPLACE PROCEDURE load_file( file_name VARCHAR2 )
AS file_lob BFILE;
binary_lob BLOB;
mime_type images.mime_type%TYPE;
extension_pos NUMBER;
BEGIN
--Use the extension of the file name to determing the MIME-type
--The MIME-type for a .pdf file will be application/pdf
extension_pos := INSTR( file_name, '.' );
mime_type := 'application/' || SUBSTR( file_name,extension_pos + 1,LENGTH( file_name ) );
-- Insert a new row into the images table. Get the LOB locator
-- for the newly inserted row
-- we will be using that to insert
-- the content from the file.
INSERT INTO TESTBLOB( blobid, filename, mime_type, content )
VALUES( 1, file_name, mime_type, EMPTY_BLOB() )
RETURNING content INTO binary_lob;
-- Open up the file in the IMAGES directory named file_name,
-- load that file into the newly created LOB locator, and
-- close the file
file_lob := BFILENAME( 'TESTDIRECTORY', file_name );
dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
dbms_lob.loadFromFile( binary_lob,file_lob,dbms_lob.getLength( file_lob ) );
dbms_lob.fileClose ( file_lob );
END;
how do I have to adjust the declaration of the mime_type variable respectively what does images.mime_type%TYPE mean?
katharina -
Error for the uploading csv file to database
Hi i tried to upload the csv file to database and i am getting error as
<cffile action="read" file="#data_dir_upload#/di_audit_corp_upc_ldr_tbl.csv" variable="di_audit_corp_upc_ldr_tbl">
<!--- loop through the CSV-TXT file on line breaks and insert into database --->
<cfloop index="index" list="#di_audit_corp_upc_ldr_tbl#" delimiters="#chr(10)##chr(13)#">
<cfquery datasource="#request.dsnCAO#">
<!--- SET ANSI_WARNINGS OFF --->
INSERT INTO [dbo].[di_audit_corp_upc_ldr_tbl]
( cpt_dpt_cd,cpt_com_cd,sub_com_cd,con_upc_no,pid_lng_dsc_tx,pid_sht_dsc_tx)
VALUES
(<cfqueryparam value='#left(trim(listgetAt('#index#',2,',')),2)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',3,',')),3)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',4,',')),5)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',1,',')),13)#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#left(trim(listgetAt('#index#',5,',')),25)#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#left(trim(listgetAt('#index#',6,',')),12)#' cfsqltype="cf_sql_varchar">)
</cfquery>
</cfloop>
Error:
An error occurred while executing DTS package to import data.
Invalid list index 6.
In function ListGetAt(list, index [, delimiters]), the value of index, 6, is not a valid as the first argument (this list has 5 elements). Valid indexes are in the range 1 through the number of elements in the list.
i am unable to solve this issue can any one will help me to solve this issue
Thanks,
KiranI take it your are trying to use a csv file to insert new data into a database, using flex and coldfusion?
if so, then I would load the file in flex using cffile in ColdFusion and then use Load Data if you are using MySQL
This can show you more about it.
http://blog.tygate.com/?p=75
We get very large csv files ftp'd to us every week, and we have to load them in to the db. this works for us.
Maybe you are looking for
-
I have had a reinstall nightmare getting my loops back they are in the apple library, I can access them through the media browser but I only have a few available through the loop browser, how do I get them all back there again? please help
-
Automatic PO Generation from Sshipment Cost Document
Hi SAP Gurus Whenever we transfer shipment cost document to FI, in the background PO will be automatically generated.. I have set Generate PO as B (Generate purchase order for validity period of 1 week) in T_56.. The problem is whenever we transfer t
-
MacBook has started to shut down randomly.
I've had my MacBook for almost four months now and have loved it so far-- no problems. Then, a few days ago, out of the blue, it started shutting off randomly. I called AppleCare yesterday and they suggested I install an update for the fan, which I d
-
How to set a field as mandatory when another field contains specific values
Hi SAP Experts, Is it possible to set the Plant Specific Material Status field as mandatory when the DChain-spec. status field contains a specific set of values? Thanks. Regards, Kim Yong
-
I can not make 16bit tiff file out
Hello. This is kamecame from japan. I am seeing this US board because Japanese discussion board is not active. I have a queation about shake. I hope to convert Quick Time(motion jpg)to Tiff file format(16bit LZW). I made a success of 8bit Tiff file o