how to get author from file when upload using upload control using javascript

function CheckSchemaFileExistence() 

{

var Schemafilename=document.getElementById('<%= this.flUploadB.ClientID %>').value;

if(Schemafilename.length>0)

{

return true;

}

else

{

alert("File Name cannot be empty");

return false;

}

}

 

we written code in button click . i need a file author name . how to find it can any tell me .

thanks in advance

0
harish448
5/20/2008 8:10:34 AM
ūüďĀ asp.net.client-side
ūüďÉ 24353 articles.
‚≠ź 1 followers.

ūüí¨ 1 Replies
ūüĎĀÔłŹ‚Äćūüó®ÔłŹ 852 Views

Hi harish448

For your information, I know you want to get the file's author name, which from client-side

But I think Not all type of files have the attribute of "author name" (I think only office file like .doc .xls have)

if you want to get a .doc file's author name, I suggest you to use OWC

The following code show how to get a doc file's author name and subject, Hope this helps:

    Word.Application oWord;
            Word._Document oDoc;
            
object oMissing = Missing.Value;
            
object docBuiltInProps;

            
object Source = @"DocPath";
            
object Unknown =Type.Missing;
            oWord 
= new Word.Application();
            
            
try
            
{
                oDoc 
= oWord.Documents.Open(ref Source,ref Unknown, 
                    
ref Unknown,ref Unknown,ref Unknown, 
                    
ref Unknown,ref Unknown,ref Unknown, 
                    
ref Unknown,ref Unknown,ref Unknown, 
                    
ref Unknown );

                docBuiltInProps 
= oDoc.BuiltInDocumentProperties;
            
                Type typeDocBuiltInProps 
= docBuiltInProps.GetType();
            
            
                
//√®¬é¬∑√•¬Ź¬Ė√§¬Ĺ¬ú√®¬Ä¬Ö
                string index = "Author";
                
string propsValue;
                
                
object docAuthor = typeDocBuiltInProps.InvokeMember("Item", 
                    BindingFlags.Default 
| 
                    BindingFlags.GetProperty, 
                    
null,docBuiltInProps, 
                    
new object[] {index} );
            
                Type typeDocAuthorProp 
= docAuthor.GetType();
                
                propsValue 
= typeDocAuthorProp.InvokeMember("Value", 
                    BindingFlags.Default 
|
                    BindingFlags.GetProperty,
                    
null,docAuthor,
                    
new object[] {} ).ToString();
                
                MessageBox.Show( propsValue,
"Author" );

                
//√®¬é¬∑√•¬Ź¬Ė√§¬ł¬Ľ√©¬Ę¬ė
                index = "Subject";
                propsValue 
= "The Subject";
                
                
object docSubjectProp = typeDocBuiltInProps.InvokeMember("Item", 
                    BindingFlags.Default 
| 
                    BindingFlags.GetProperty, 
                    
null,docBuiltInProps, 
                    
new object[] {index} );
            
                Type typeDocSubjectProp 
= docSubjectProp.GetType();
                
                propsValue 
= typeDocSubjectProp.InvokeMember("Value", 
                    BindingFlags.Default 
|BindingFlags.GetProperty,
                    
null,docSubjectProp,
                    
new object[] {} ).ToString();
                
                MessageBox.Show( propsValue,
"Subject" );

            }

            
finally
            
{
                
//√•¬Ö¬≥√©¬ó¬≠word√®¬Ņ¬õ√߬®¬č
                object save = false;
            
                oWord.Quit(
ref save,ref Unknown,ref Unknown);
            
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);    
            }

Regards!

-- "Mark As Answer" If my reply helped you --
0
blodfox777
5/20/2008 8:31:54 AM