Uploading a file in KM using KM API
Hi,
How to upload a file into KM using KM API.
Regards
MQ
Hi,
Pls go thru the below code.
public static final String uptoKm(com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource resource){
try {
ResourceContext contex= new ResourceContext(WPUMFactory.getUserFactory( ).getEP5User(req.getUser( )); );
IResourceFactory factory = ResourceFactory.getInstance();
RID rid = RID.getRID(PATH);
ICollection folder = (ICollection)factory.getResource(rid,contex);
Content content = new Content(resource.read(true),"byte",-1);
folder.createResource(resource.getResourceName(),null,content);
return resource.getResourceName();
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (ResourceException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
Above method accept parameter of resource and return file name on sucessfully uploaded.
best regards
Hari.
Similar Messages
-
How do I upload an XML file to salesforce using BULK API?
Hi There,
Please let me know how do we upload an XML file to salesforce using Bulk API?
Thanks,
ETHi,
I think that this is a more SalesForce.com question and think you will have more chance looking at SOAP API Developer's Guide for salesforce. Sending a SOAP request from the API Server is very straight forward and there are several tutorials and well documented about this.
Cheers,
Stefan -
Uploading a file to server using servlet (Without using Jakarta Commons)
Hi,
I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
From
Velu<p>Why put such a restriction on the solution? Whats wrong about using that library?
The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
I was with the view that the same can be implemented by our own code right? -
How to upload Excel file in BI using function module in abap program
How to upload Excel file in BI using function module in abap program?
Hi Anuj,
To upload the file , you can try a standard program "RSEPSFTP" .
while you execute the program , a selection screen appears in which the inputs should be give as
RFC destination - The target server name
FTP command- PUT
local file - your file name
local directory - path of your local file
remote file - your target file name
remote directory - where it has to be stored
Hope this is useful for you
Thanks & regards
Anju -
How to upload a file into server using j2ee jsp and servlet with bean?
How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
Anyone help me please!u don't need j2ee and struts to do file uploading. An example is as such
in JSP. u use the <input> file tag like
<input type="file"....>You need a bean to capture the file contents like
class FileUploadObj {
private FormFile srcFile;
private byte[] fileContent;
// all the getter and setter methods
}Then in the servlet, you process the file for uploading
* The following loads the uploaded binary data into a byte Array.
FileUploadObj form = new FileUploadObj();
byte[] byteArr = null;
if (form.signFile != null) {
int filesize = form.srcFile.getFileSize();
byteArr = new byte[filesize];
ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
bytein.read(byteArr);
bytein.close();
form.setFileContent(byteArr);
// Write file content using Writer class into the destination file in the server.
... -
Upload Excel File to SharePoint using VBA
Hi,
I copied and modified the code from a friend which he got it from this website forum.
This apprantely works for some people and not me. Please tell me what I am doing wrong.
Ignore xxxxxx part of the Sharepoint site. Nothing wrong with the site, i tried many combinations, but I get not response, not even an error.
Public Const HR_URL = "http://sun.xxxxxx.com/eng/st/Lists/Database%20Change% 20Request"
Sub test()
'Upload new Excel sheet to SharePoint
Call copyToSharePoint(HR_URL, ThisWorkbook.FullName)
End Sub
'''''''code block from Forum
Public Sub copyToSharePoint(sharepointURL As String, filePath As String)
'On Error GoTo errhandler
'sharePointUrl should not end in a "/"
'Initialize Variables
Dim LlFileLength As Long
Dim Lvarbin() As Byte
Dim LobjXML As Object
Dim LvarBinData As Variant
Dim LstrFileName As String, PstrFullfileName As String, PstrTargetURL As String
Dim fileName As String, lenFileName As Long
'Extract file name
lenFileName = Len(filePath) - InStrRev(filePath, "\")
fileName = Right(filePath, lenFileName)
'Check that the webUrl ends in an "/"
If Right(sharepointURL, 1) <> "/" Then
sharepointURL = sharepointURL & "/"
End If
'**************************** Upload binary files *****************
Set LobjXML = CreateObject("Microsoft.XMLHTTP")
PstrFullfileName = filePath
LlFileLength = FileLen(PstrFullfileName) - 1
' Read the file into a byte array.
ReDim Lvarbin(LlFileLength)
Open PstrFullfileName For Binary As #1
Get #1, , Lvarbin
Close #1
' Convert to variant to PUT.
LvarBinData = Lvarbin
PstrTargetURL = sharepointURL & fileName
' Put the data to the server; false means synchronous.
LobjXML.Open "PUT", PstrTargetURL, False
' Send the file in.
LobjXML.Send LvarBinData
Set LobjXML = Nothing
Exit Sub
errhandler:
If Err.Number = 53 Then
MsgBox "Excel was unable to create the HR file to submit to SharePoint. " & vbNewLine & _
"Please check that you are not running out of disk space and that no MS Office add-in is causing issues with Excel.", vbCritical, "File Error"
Exit Sub
Else
MsgBox "Your HR could not be submitted to SharePoint. The following error occurred:" & vbNewLine & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, "Error Uploading to SharePoint"
Exit Sub
End If
End SubI have made the following code work successfully on a Windows 8 machine with the VBA executing from an Excel 2010 file and the file you want to upload going to a SharePoint 2010 site. If you don't need to use SP content types then simply
take that out of the code. Also, pay attention to the FieldInformation as the Field Display names and Field Internal names can sometimes be different. Cheers.
Public Sub copyDocToSP()
Const strLocalFile = "C:\temp\myLocalFile.pdf"
Const spBASE_URL = "https://thesharepointdomian/sites/yoursite/"
Const spDOC_LIB = "Your SP Doc Library Name"
Const spFILE_NAME = "FileNameOnceOnSharepoint.pdf"
Const spCONTENT_TYPE = "0x000000000000000000000000000000000000000"
Set ObjectStream = CreateObject("ADODB.Stream")
Set ObjectDOM = CreateObject("Microsoft.XMLDOM")
Set ObjectElement = ObjectDOM.createElement("TMP")
Set ObjectHTTP = CreateObject("Microsoft.XMLHTTP")
'Reading binary file
ObjectStream.Open
ObjectStream.Type = 1 'Type Binary
ObjectStream.LoadFromFile (strLocalFile)
BinaryFile = ObjectStream.Read()
ObjectStream.Close
'Conversion Base64
ObjectElement.DataType = "bin.base64" 'Type Base64
ObjectElement.nodeTypedValue = BinaryFile
EncodedFile = ObjectElement.Text
'Build request to load document
strURLService = spBASE_URL + "_vti_bin/copy.asmx"
strSOAPAction = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"
strSOAPCommand = "<?xml version='1.0' encoding='utf-8'?>" & _
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _
"<soap:Body>" & _
"<CopyIntoItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" & _
"<SourceUrl>" + strLocalFile + "</SourceUrl>" & _
"<DestinationUrls>" & _
"<string>" + spBASE_URL + spDOC_LIB + "/" + spFILE_NAME + "</string>" & _
"</DestinationUrls>" & _
"<Fields>" & _
"<FieldInformation Type='Text' InternalName='Title' DisplayName='Title' Value='this is the title value' />" & _
"<FieldInformation Type='Choice' InternalName='Our_x0020_Status' DisplayName='Our Document Status' Value='Ready-to-distribute' />" & _
"<FieldInformation Type='Text' InternalName='ContentTypeId' DisplayName='Content Type ID' Value='" + spCONTENT_TYPE + "' />" & _
"</Fields>" & _
"<Stream>" + EncodedFile + "</Stream>" & _
"</CopyIntoItems>" & _
"</soap:Body>" & _
"</soap:Envelope>"
ObjectHTTP.Open "Get", strURLService, False
ObjectHTTP.SetRequestHeader "Content-Type", "text/xml; charset=utf-8"
ObjectHTTP.SetRequestHeader "SOAPAction", strSOAPAction
ObjectHTTP.Send strSOAPCommand
MsgBox (ObjectHTTP.responseText)
End Sub -
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 -
How to upload pdf files to icloud using a pc
While using MobileMe and Idisk on my pc was extremely easy, turning to iCloud seems to be more cahotic. i.e. I cannot upload PDF file from my pc to iCloud. Any suggestion?
ThanksHi Ajay,
Using FILE_UPLOAD UI element you can upload files..
Please check this..
http://help.sap.com/saphelp_ERP2005/helpdata/en/b3/be7941601b1d09e10000000a155106/content.htm
http://wiki.sdn.sap.com/wiki/display/WDABAP/ExcelFileUploadAndDisplayDataUsingWebDynPro+ABAP
Upload PDF file to Webdynpro
Cheers,
Kris. -
Uploading csv file into database using apex
Dear all
I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
below mentioned is error and the code
ERROR:
ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
Error
OK
CODE:
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
BEGIN
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv';
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11);
-- Clear out
v_line := NULL;
END IF;
END LOOP;
END;
what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
thanks in advance
regards
UdayHi,
Mistakes in your sample I did correct
Problem 1
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv'; to
select blob_content into v_blob_data
from wwv_flow_files where name = :P1_FILE;Problem 2
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11); to
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
v_data_array(9),
v_data_array(10),
v_data_array(11); And I did create missing table
CREATE TABLE TABLE_X
v1 VARCHAR2(255),
v2 VARCHAR2(255),
v3 VARCHAR2(255),
v4 VARCHAR2(255),
v5 VARCHAR2(255),
v6 VARCHAR2(255),
v7 VARCHAR2(255),
v8 VARCHAR2(255),
v9 VARCHAR2(255),
v10 VARCHAR2(255),
v11 VARCHAR2(255)
);Regards,
Jari
Edited by: jarola on Nov 19, 2010 3:03 PM -
How to upload multiple files in Webdynpro using File upload Screen Element
Hi Experts,
Can anybody tell me how to upload multiple files/pdfs in webdynpro using file upload screen element, and also please tell me what is the maximum storage limit of RAWSTRING data type,Advance Thanks.
Regards,
SandeshHi Sandesh,
this is simply not supported, not in WebDynpro nor in standard HTML.
A workaround is to upload a ZIP with all files and on server side unpack the ZIP and operate on the single files.
I hope it will help u..
----------------------OR-------------------------
As you know using File upload UI element we can upload only one file at a time. There may be a scenario where user may want to upload any no of files at a time which is not determined at design time. This can be acheived using the ACF UpDownload UI element which requires a security whiltelist to be created
http://scn.sap.com/docs/DOC-2270
----------------------OR-------------------------
You can use Table UI element.
Regards,
Deepak Singh -
How to upload & Download file in Adf using Jdeveloper 11.1.2 ??
Hi All,
I have just started working on Oracle ADF, Thanks a lot guys for solving our queries.
I'm using Jdeveloper 11.1.2, How to upload and download file in ADF..?
I have seen couple links on net but none of them worked on jdeveloper 11.1.2......
Please Help......Hi guys,
I'm able to download file in ADF using af:fileDownloadActionListener.......
does any one knows how to upload a file using ADF??? -
Combining files in php using the api
I am trying to automate the process of cobining multiple tiffs into pdfs using the iac api.
I keep getting a call to member function on a non-object error if any of you could see why this error is happening or sugest a better way to solve the problem I would greatly appreciate it
$AdobeApp = new COM("AcroExch.App");
$AVDocument = new COM("AcroExch.AVDoc");
$PDDocument = new COM("AcroExch.PDDoc");
$file = 'c:/test.pdf';
$create = $PDDocument->Create();
echo $create . chr(10) . chr(13);
$combo = 'c:/0013947320101071-705666408_4-97.tif';
$insert = $PDDocument->InsertPages(0,$combo);
echo $insert . chr(10) . chr(13);
$npages = $PDDocument->GetNumPages();
$combo = 'c:/0013947320101071-705666408_1-94.tif';
$PDDocument->InsertPages($npages -1,$combo);I guess I missed that part of the documentation. I've gone through the documentation a good deal of times and can't find anything other than that that would be useful. Do you have any suggestions? Have I missed something? Is it possible to combine tiffs into a pdf using the api?
-
when sending email through yahoo account , i cant upload any attachment with email, a sign of uploading lasts forever without uploading the file.
this issue do not happen with hotmail account or when using IE to browse Yahoo account.Install ClamXav and run a scan with that. It should pick up any trojans.
17" 2.2GHz i7 Quad-Core MacBook Pro 8G RAM 750G HD + OCZ Vertex 3 SSD Boot HD
Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101 -
Uploading a file from form using Jsp to webserver
WE tried to upload a file to a webserver. We tried different ways that we got code from this forum.
but unable to access the data sent from the browser.
Plssss go thro the code and let us know what the problem is.......
<%
try
ServletContext context = getServletContext();
InputStream mySis = request.getInputStream();
out.println(mySis.available());
BufferedReader r = new BufferedReader(new InputStreamReader(mySis));
String line = null;
StringBuffer buf = new StringBuffer();
while ((line = r.readLine())!=null) {
out.println(line);
buf.append(line);
out.println("********PRINT");
out.println(buf.toString());
}catch(Exception ee){out.print("error");}
%>
We also tried the code posted in this forum
InputStream mySis = request.getInputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
do
myCurrentByte = mySis.read();
bos.write(myCurrentByte);
Appreciate ur help.use the FileUpload package. it's part of the jakarta commons packages. works great, decent docs. I use it in several production systems.
-
Upload document to Temp Folder using Rest API not working
I am using Poster in Firefox to upload an xml document to document Temporary Folder. Response I'm getting is 400 Bad Request. Is this a problem with Poster not supporting file upload to UCCX or are there parameters i'm missing for this?
Url=http://<uccx fqdn>/adminapi/document/uploadFile
User Auth=Administrator user
File=xml file stored on my computer
Content Type=multipart/form-data
Action=POST
Everything else is blank.
Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><apiErrors><apiError><errorData>Bad Request</errorData><errorMessage>The request could not be understood by the server due to malformed syntax</errorMessage><errorType>400</errorType></apiError></apiErrors>
Finnurquery = "Select SI_ID,SI_NAME FROM CI_INFOOBJECTS "
+ " where SI_ID='" + SelectedReportDetails.Rows[i]["ID"].ToString() + "'";
Change this to a Select *... Since your only bringing back Si_ID and Si_Name.. your not bringing back other properties it needs to make a successful copy..
Maybe you are looking for
-
Need Help Fast! Page is dispalying twice in quiz
I have created a quiz using tips from another post in this forum. I insterted a regular slide with a continue button before the quiz questions. I insterted another regular slide at the end of the questions with a re-take button that points to that fi
-
Unexpected Error: The underlying connection was closed
Hi All, I have a requirement to send SMS to user after submitting a form. I have created a visual web part and it is working fine in my test environment. When the same webpart is deployed to production, i am getting an error like "Unknown SMS Error:
-
PdfSource of InteractiveForm UI element should be populated with pdf binary
Hey Guys... I need some help here... I have a Web Dynpro Java Application that retrieves data from R/3 and I want to (only) display that data using Adobe. I've set the "mode" property of the UI Element as "usePdf" and I have bound the pdfSource prop
-
Screen exit for transaction VT01N
Hi all, Is there any screen exit for the transaction VT01N , VT02N ?
-
Strange accout called other on my mac book
After logging in the other day I noticed a account called other the account wanted a username and password which i didnt know I went the the account section in system pref. but the account "other account" was not my question is were did this come fro