How to Insert user selected files as list attachment using JavaScript?
I could able to Inset list items using ECMA Script, But for the user added attachment how to save it to list item.
Please help
check the similar post
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3d92510f-f966-45b2-989d-734ba21c5ce5/how-to-attach-file-to-list-item-using-javascript-in-sharepoint-2010?forum=sharepointcustomizationprevious
More links
http://sharepoint.stackexchange.com/questions/88487/using-sharepoint-client-api-to-upload-file-as-attachment-in-javascript
http://sharepoint-community.net/forum/topics/copy-attachments-of-sharepoint-list-item-to-a-document-library
Similar Messages
-
How to insert a image file into oracle database
hi all
can anyone guide me how to insert a image file into oracle database now
i have created table using
create table imagestore(image blob);
but when inserting i totally lost don't know what to do how to write query to insert image fileHi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
out.println(" <input type='submit' name='submit' value='Submit' class='smalltext'>");
out.println("</form>"); Import this once you have the jar file:
import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
boolean result = true;
String fileName = null;
byte fileData[] = null;
String fileUploadError = null;
String imageType = "";
String error = "";
DiskFileUpload fb = new DiskFileUpload();
List fileItems = fb.parseRequest(request);
Iterator it = fileItems.iterator();
while(it.hasNext()){
FileItem fileItem = (FileItem)it.next();
if (!fileItem.isFormField()) {
fileName = fileItem.getName();
fileData = fileItem.get();
// Get the imageType from the filename extension
if (fileName != null) {
int dotPos = fileName.indexOf('.');
if (dotPos >= 0 && dotPos != fileName.length()-1) {
imageType = fileName.substring(dotPos+1).toLowerCase();
if (imageType.equals("jpg")) {
imageType = "jpeg";
String filePath = request.getParameter("FILE_PATH");
session.setAttribute("filePath", filePath);
session.setAttribute("fileData", fileData);
session.setAttribute("fileName", fileName);
session.setAttribute("imageType", imageType);
return result;
} And now finally the method to actually write the file to the database:
private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
//If the previous code found a file that can be uploaded then
//save it into the database via a pstmt
String sql = "";
UtilDBquery udbq = getUser(request).connectToDatabase();
Connection con = null;
int signatureID = 0;
PreparedStatement pstmt = null;
try {
udbq.setUsePreparedStatements(true);
con = udbq.getPooledConnection();
con.setAutoCommit(false);
if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
pstmt = con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while(rs.next()) {
signatureID = rs.getInt(1);
if (fileName != null && imageType != null) {
sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, signatureID);
pstmt.setBinaryStream(2, is2, (int)(fileData.length));
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
if(mode.equals("U") && signatureIDIn != 0) {
signatureID = signatureIDIn.intValue();
if (fileName != null && imageType != null) {
sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setBinaryStream(1, is2, (int)(fileData.length));
pstmt.setInt(2, signatureID);
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
} catch (Exception e) {
con = null;
throw new Exception(e.toString());
return signatureID;
} -
How to insert a pdf file from a dynamic location into a table
Hi friends
Can any one please let me know how to insert a pdf file into a table from a dynamic location in server.
suppose say i have a table CUST_BLOB(file_name, file_data). I have a file in directory c:\local having file_name test.pdf
I want to insert this file in CUST_BLOB. Please help me.
Thanks in advance.
--Ahmeduser620950 wrote:
Hi friends
Can any one please let me know how to insert a pdf file into a table from a dynamic location in server. Why dynamic locations on the server?
Make it a business case that the files should be stored in specific location(s).
Oracle uses directory objects to point to locations on the file system and, whilst these locations can be altered, it is better practice to set up specific locations and grant permission to the correct users for those locations so that there is full control over who is accessing what on the server. Whilst filenames may be dynamic, I wouldn't recommend using dynamic locations. -
How to insert a gif file into a table?
Hi,
I need to insert a gif file into a table. Can anyone tell me where I can find the information on how to create this kind of table, how to insert a gif file into a table and how to select?
Thanks,
HelenHi Helen,
You could read about that in the documentation which is available online.
For a starter: BLOB. And I bet there are many examples to be found on the web.
Good luck. :)
Regards,
Guido -
How to insert an image file in Oracle database
hi
can you please tell me how to insert an image file into oracle database????
suppose there is one image file in c:\pictures\rose.jpg. how to insert that file into database? theoretically i know that will be BFILE type but i dont know how to insert that.
will be waiting for your reply........
thanks & regards,
PriyatoshHello,
The easiest way to load a blob is to use SQL loader.
This example comes from the utilities guide:
LOAD DATA
INFILE 'sample.dat'
INTO TABLE person_table
FIELDS TERMINATED BY ','
(name CHAR(20),
1 ext_fname FILLER CHAR(40),
2 "RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
Datafile (sample.dat)
Johny Quest,jqresume.txt,
Speed Racer,'/private/sracer/srresume.txt',
Secondary Datafile (jqresume.txt)
Johny Quest
500 Oracle Parkway
Secondary Datafile (srresume.txt)
Loading LOBs
10-18 Oracle Database Utilities
Speed Racer
400 Oracle Parkway
regards,
Ivo -
How to insert or select value d'silva
Hi,
How to insert or select value d'silva into/from table.
please let me know.
Thanks,
Sathis.Just escape the ' character:
SQL> insert into emp values(999, 'D''Silva', 'Jose');
1 row created.
SQL> select * from emp where last_name = 'D''Silva';
EMPLOYEE_ID LAST_NAME FIRST_NAME
999 D'Silva Jose
[pre] -
How to insert the select query result into table?
How to insert the select query result into table?
SELECT top 20 creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;
Thanks,
Tirumala1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
HT201301 how to add app to file sharing list ?
how to add app to file sharing list ?
For expamle, i have autocad ws app on iPad. When i had previous version of iTunes i saw this program in file sharing list.
After upgrading iTunes AutoCad have gone from this list, how can I return this back?
Thank You.From what I read in the app description in iTunes on my computer, you need some sort of account and you use this with a desktop program as well. Files are uploaded to a server???
I see no mention of file sharing in the app description.
https://itunes.apple.com/app/autocad-ws/id393149734?mt=8
BTW, you cannot add an app to file sharing - it has to suppport file sharing on it's own - it must be built into the app. If the app supports file sharing, it will be in the file sharing apps list in iTunes. -
How to find number of files in a folder using pl/sql
please someone guide as to how to find number of files in a folder using pl/sql
RegardsThe Java option works well.
-- results table that will contain a file list result
create global temporary table directory_list
directory varchar2(1000),
filename varchar2(1000)
on commit preserve rows
-- allowing public access to this temp table
grant select, update, insert, delete on directory_list to public;
create or replace public synonym directory_list for directory_list;
-- creating the java proc that does the file listing
create or replace and compile java source named "ListFiles" as
import java.io.*;
import java.sql.*;
public class ListFiles
public static void getList(String directory, String filter)
throws SQLException
File path = new File( directory );
final String ExpressionFilter = filter;
FilenameFilter fileFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
if(name.equalsIgnoreCase(ExpressionFilter))
return true;
if(name.matches("." + ExpressionFilter))
return true;
return false;
String[] list = path.list(fileFilter);
String element;
for(int i = 0; i < list.length; i++)
element = list;
#sql {
insert
into directory_list
( directory, filename )
values
( :directory, :element )
-- creating the PL/SQL wrapper for the java proc
create or replace procedure ListFiles( cDirectory in varchar2, cFilter in varchar2 )
as language java
name 'ListFiles.getList( java.lang.String, java.lang.String )';
-- punching a hole in the Java VM that allows access to the server's file
-- systems from inside the Oracle JVM (these also allows executing command
-- line and external programs)
-- NOTE: this hole MUST be secured using proper Oracle security (e.g. AUTHID
-- DEFINER PL/SQL code that is trusted)
declare
SCHEMA varchar2(30) := USER;
begin
dbms_java.grant_permission(
SCHEMA,
'SYS:java.io.FilePermission',
'<<ALL FILES>>',
'execute, read, write, delete'
dbms_java.grant_permission(
SCHEMA,
'SYS:java.lang.RuntimePermission',
'writeFileDescriptor',
dbms_java.grant_permission(
SCHEMA,
'SYS:java.lang.RuntimePermission',
'readFileDescriptor',
commit;
end;
To use:
SQL> exec ListFiles('/tmp', '*.log' );
PL/SQL procedure successfully completed.
SQL> select * from directory_list;
DIRECTORY FILENAME
/tmp X11_newfonts.log
/tmp ipv6agt.crashlog
/tmp dtappint.log
/tmp Core.sd-log
/tmp core_intg.sd-log
/tmp da.sd-log
/tmp dhcpclient.log
/tmp oracle8.sd-log
/tmp cc.sd-log
/tmp oms.log
/tmp OmniBack.sd-log
/tmp DPISInstall.sd-log
12 rows selected.
SQL> -
How to Insert Sharepoint 2013 Person or Group Field using VBA
Hello,
How to Insert Sharepoint 2013 Person or Group Field using VBA , I tried set the field with ID / ID;Name / Name
but all failed, Please advice
Function SetSP_Field(F_Yer As Single, F_WekNo As Single, F_ProjectNum As String, strField As Variant, strFieldValue As Variant) As String
' test code
Dim rst As Recordset
Dim strSQL As String
Dim SP_RecSet As ADODB.Recordset
Set SP_RecSet = New ADODB.Recordset
SetSP_Field = False
strSQL = "Status Report"
On Error Resume Next
Call SP_Connect(2)
strSQL = "select " & SP_List & ".* From " & SP_List _
& " Where [Year] = " & CInt(F_Yer) _
& " and [WeekNo] = " & CInt(F_WekNo) _
& " and [Compass_Code] = '" & F_ProjectNum & "' ; " _
' & " Set " & strField & " = " & strFieldValue
'Debug.Print strSQL
'Debug.Print SP_CN
SP_RecSet.Open strSQL, SP_CN, adOpenStatic, adLockOptimistic
If SP_RecSet.RecordCount = 0 Then
Debug.Print "Record for project: " & F_ProjectNum & " not found"
LogFile.WriteLine ("Record " & strID & " not found")
End If
If Not SP_RecSet.EOF Then
'SP_RecSet.Edit
SP_RecSet.Fields(strField) = strFieldValue
SP_RecSet.Update
If Err.Number <> 0 Then
MsgBox ("SP Update Error: " & Err.Description)
GoTo Exit_Fun
End If
SetSP_Field = True
End If
Exit_Fun:
SP_RecSet.Close
Set SP_RecSet = Nothing
End FunctionHi Tim,
Let’s verify the followings:
Whether this issue occurred for other lists in the same site.
Whether this issue occurred for all users who don’t have full control.
Whether this issue occurred on other sites.
When you created the people & group column, which show field did you used? Please try to use a different show field for the people & group column, compare the result.
In addition, please check if the link is useful:
http://www.learningsharepoint.com/2013/08/21/empty-value-in-people-picker-after-saving-the-list-form-in-sharepoint/
Best Regards,
Wendy
Wendy Li
TechNet Community Support -
I need to back up my imac running Tiger (no time machine) so that we can upgrade OS. It is set up for multiple accounts. How do I capture all files in each account using newly purchased USB external hard drive? Thanks!
Backup Software Recommendations
Carbon Copy Cloner
Data Backup
Deja Vu
SuperDuper!
Synk Pro
Tri-Backup
Others may be found at VersionTracker or MacUpdate.
Visit The XLab FAQs and read the FAQ on backup and restore. Also read How to Back Up and Restore Your Files.
Or you can simply use the Restore option of Disk Utility to clone the drive to the backup:
Clone using Restore Option of Disk Utility
Open Disk Utility from the Utilities folder.
Select the destination volume from the left side list.
Click on the Restore tab in the DU main window.
Check the box labeled Erase destination.
Select the destination volume from the left side list and drag it to the Destination entry field.
Select the source volume from the left side list and drag it to the Source entry field.
Double-check you got it right, then click on the Restore button.
Destination means the external backup drive. Source means the internal startup drive. -
How can I disable Select Tool & enable Hand Tool using Adobe JavaScript ?
How can I disable Select Tool & enable Hand Tool using Adobe JavaScript ?
I want wherever the PDF opened automatically preferrence changed, default HAND TOOL remain selected. I want to do it using Adobe JavaScript.You are correct in that it's not functioning, however I do not have that option under the "online and adobe online" section in Adobe Customization Wizard XI. I have the following boxes that can be checked:
"Disable initiating shared reviews and data collection via distributed forms using Adobe online services (does not affect non Adobe online services reviews and forms).
"Disable the Tools pane in Reader"
"Disable file storage on Adobe online services"
"Enable file storage even when all other services are disabled" -
How to load a client file in a clob using sqlcl
How to load a client file in a clob using sqlcl
You don't "load" jars. If it's on the classpath, you can obtain individual resources from it using various methods on either Class or ClassLoader. Do you mean "how to add a jar to the classpath at runtime"? Can't be done without using a classloader, typically URLClassLoader or a subclass thereof. Why you want to not use the proven method is beyond me. Presumably because you don't understand classloading. In which case, forget it.
-
How to create the log file in remote system using log4j.
Hi,
How to create the log file in remote system using log4j. please give me a sample code or related links.The below example i used for create the log file in remote system but it return the below exception.Is there any authandication parameter for accessing the remote path? Please help.
public class Logging
Logger log=null;
FileAppender fileapp=null;
public Logging(String classname)
try
log = Logger.getLogger(classname);
String path=" [\\192.168.0.14\\c$\\LOG\\d9\\May_08_2008_log.txt|file://\\192.168.0.14\\c$\\LOG\\d9\\May_08_2008_log.txt]";
fileapp = new FileAppender(new PatternLayout("%r [%t] %-5p %c %x - %m%n"),path, true);
log.addAppender(fileapp);
log.info("Logger initilized");
}catch(Exception ex)
ex.printStackTrace();
java.io.FileNotFoundException: \\192.168.0.14\c$\LOG\d9\May_08_2008_log.txt (The network path was not found)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
at org.apache.log4j.FileAppender.<init>(FileAppender.java:109)
at annwyn.logger.BioCapLogger.<init>(Logging.java:23)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Please help.
Thanks in advance.
Saravanan.KSorry path is missing for the above request.
path="\\192.168.0.14\c$\LOG\d9\May_08_2008_log.txt ";
please help.
Saravanan.K -
How to open a pdf file and then attach it with images
I am new to Indesign Server.
I'm currently working on a pdf.
I have a white blank pdf template.
that I want to attach/glue it with images.
How to open a pdf file and then attach it with images.
Please, help me.
Thanks.First step would be to make yourself familiar with InDesign desktop version.
Whatever you intend to achieve, do it there manually. (see regular app docs or forums)
Then try to automate your steps with scripting (see scripting docs or forum)
If you can do it with a script in the desktop version, that script will likely also run in ID Server. (see server forum).
If you can specify missing features not achievable thru scripting or manual use, reconsider to write a plugin (this forum).
A seasoned C++ programmer will need a few months to learn the basics, wade thru tons of documentation etc. Alternatively consider to hire a consultant to do the development work for you.
Dirk
Maybe you are looking for
-
InDesign CS5.5 does not display fonts correctly
InDesign CS5.5 does not display Futura fonts correctly. I have removed all versions of Futura from FontBook on my Mac (running Mac OSX 10.7.4) but CS5.5 - Indesign, Illustrator & photoshop - still displays Futura as being open but only InDesign does
-
My browsers are not loading even @home with my wifi
I was emailed some instructions on how to cut down on the drainage of my phone batterie, one of the instructions included from apple to download a certain app for VPN, try it out & change the settings of the VPN on my phone. I did as much changing of
-
Hi all, Can anyone tell me how I can increase the cell padding ie the cell size and also the font size inside the cell for table web item. There is no property to achieve this, we can change the static html code but that doesn't solve my problem. D
-
Unable to run any transaction. ABAP runtime errors generated
Dear All, I am updating the SAP BASIS support package SAPKB70012 in the DEV server. The import phase was running through SPAM. It ran for 40 minutes and resulted in a ABAP dump. syntax error in program. I tried to run SPAM once again, It gave another
-
How do you compile JNI in Linux
I do JNI well windows using command line facility from Visual Studio but i have never learnt compiling native code for Linux...