.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
Clintonzz
cathyhill345
arronlee
mattyclown
Post New Web Links

Get file path in javascript

Posted By:      Posted Date: October 29, 2010    Points: 0   Category :ASP.Net
 

Hello friends,

          In one application I want to pass image file path to image control through JavaScript. Its working fine by manually passing file path to that control. But it's not possible to give manual path every time. So is there any property in JavaScript so that I can give only file name and path should get generated. (i.e. like server.mappath (filename) in asp.net ).Or is  there any other solution?

      


   




View Complete Post


More Related Resource Links

>>>How to use javascript function in aspx file?

  

Hi,

I have a file util.js and there some funtions in same file.

For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

Anyone have idea. Do share with me.

I used the reference like this:

Javascripts/util.js

' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">


File Attachments from info-path forms to Sharepoint document library

  

Hi Experts,

How to upload file attachements from info-path forms to Sharepoint document library?

I need to add attachement from local-PC/Any User to Sharepoint Document Library.

 

Any help please?? Appreciated

 

Regards,

Kumar


How do I find the file path from a namespace.class name?

  

I'm programatically looking ito a .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below:

 

Dim Assm As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom("myApplication\bin\myApplication.dll")
Dim ClassType As Type = Assm.GetType("myApplication\myPage.aspx.vb")
    
' myBaseType = "myApplication.Forms.BasePage"
Dim myBaseType As System.Type = ClassType.BaseType

 

Now I want to read the BaseFile (class = myApplication.Forms.BasePage). However, to read in this file, I need I need to get its full path instead of its namespace.class hiearchy. In this case, the BasePage is wrapped in a different namespace declaration thus I cannot just change the '.' to '\' in order to get the path.

How can I get the path of BasePage so I can read it? Thank you - Frank


Acces the file upload path

  
how can i acces the file upload text. I mean if i choose a file , then the file path comes in file upload e.g. c:/data/fil1.txt.All i want to acces this full path and show in a label.

Access to path xxx denied when uploading a file using c#

  
Hi I have a file upload app written in c#. The app runs on IIS on a Windows 2003 Server OS. I want the app to upload the file onto the server (The app and the server are on the same machine). This code has been working fine for a long time running on Windows Server 2000, and Windows XP Professional. Now when I moved onto Windows Server 2003, it stopped working. I have given ASPNET account full access to the folder on the server, and it still gives this error. Is this a bug in 2003, and can anybody assist me? Thanks Shane

Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not

  
Hi,I am looking for a Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not. To know it currently I am using "Directory.GetFileSystemEntries(Path).Count" and checking if count > 0 then returning True else False. For this first method calculates all the files and folder and then return status to me but I want to exit out as soon as my method gets first element(file/folder) in specified path. Because above method is timing out when my input path contains more than 1 million files. I just need to check whether input folder path contains any child file/folder or not. I have tried to use Win32 API also but on ther server it is crashing so I donot want to use that solution. In .NET any method or way is present to know it. Please suggest me.

Download a file from web and save dialog box for path

  
Hi I need to download a exe file from a web site. I need to prompt a savedialog box for the user to select a path to save it. This the code i have. How can i show a save dialog box here?         Private Sub downloadfile()         Dim client As New Net.WebClient         client.DownloadFile("www.mysite.com/Information/Myexe.exe", "Sr.exe")     End Sub Thanks

How to get a file path in a class library used by asp.net

  
 Hello,   I have an asp.net application which employs a class project to process xml files. I have an xsd file within the class project. To load the xsd file, I am not sure which path I should use. The following code snippet loads the xsd, and reads the xsd using the StreamReader. I am not sure how to set the value for xsdPath variable.// 2- Read Schema file content StreamReader SR = new StreamReader(xsdPath); // 3- Create a new instance of XmlSchema object XmlSchema Schema = new XmlSchema(); // 4- Set Schema object by calling XmlSchema.Read() method Schema = XmlSchema.Read(SR, new ValidationEventHandler(ReaderSettings_ValidationEventHandler)); Thanks  

How to pass the file path in EXEC of Stored Proc for getting IIS Logfile data

  
Hello,                  I need to get IIS Logfile data from Stored Proc. How to do this. I am using Bulk Insert Method in my stored Proc When I execute the stored proc I am getting an error that  Incorrect syntax near 'C:\WINDOWS\system32\Logfiles\W3SVC1\ex100802.log'.     Below is the code.                 Create  PROCEDURE  spWebLog @path varchar(300) AS begin exec('BULK INSERT Weblog from''' + @path + ''')  end go Declare   @SQL Varchar(100 ) Set    @SQL= 'C:\WINDOWS\system32\Logfiles\W3SVC1\ex100802.log' exec   spWebLog @SQL    

Load and parse a file where the file path is located in a column of a flat file source

  
Hi, I have a situation where I have a CSV that contains a bunch of data that populates a bunch of related tables with FK constraints directly.  Thats no problem.  The problem is that one of the columns specifies a filepath to an XML file that is supposed to contain data to be populated in a table with an FK constraint.  How do I specify the file name to the XML source component at runtime? For example TableA has columns: TableAID GroupName TableB has columns TableBID TableAID (FK to Table A) MemberID (the data in question) TableA has a 1 to many relationship with Table B. The CSV has a bunch of columns including: TableAID File path to list of members for each group. I don't know how to solve this problem.  I tried using a ForEach ... but I couldn't get it to work. Thanks in advance for any assistance.

How to capture the full file path from Async File Uploader Control?

  
Hi,I have an Async File Uploader control inside a Repeater which is inside an update panel.Now,I am uploading the file into ftp,so I am not uploading the video file,using SaveAs() method.For uploading the file in ftp,I have this UploadFile method which takes these four parameter:FileName, UploadPath, FTPUser, FTPPassword.Now this FileName,I have to send the full file path. My UploadComplete event looks like this:<pre lang="cs">protected void AsyncVideoUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)      {//VideoPath is a session variable            VideoPath = string.Empty;            if (AsyncVideoUpload.HasFile)            {               // string filepath = AsyncVideoUpload.PostedFile.FileName;                  string filepath = e.filename;//above two captures only the file name,but I want the total path,like c:/MyDocuments/...                                 UploadFile(filepath, "ftp://172.20.117.102","test","Value*12"); &

Upload image to database - couldn't find file path

  
I'm trying to display images in a GridView (yes, still this...). [edit] Before I can come to that I have to upload some images to the database.I've followed this tutorial for the "upload image to database" code (this worked fine for uploading images, but I don't know if the images were converted to byte):http://aspsnippets.com/Articles/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspxand I've followed this tutorial for the "display images in gridview" code (and "retrieve file" from the tutorial below).http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspxIt doesn't quite work, the GridView shows but without imagesNow I'm trying to change the "save file" code according to this tutorial:http://aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspxbut I don't understand everything in it. When I try to upload an image I get an error on this line:FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); //couldn't find file (path to image I tried to upload) What should I do about it?

How to include a javascript file in a custom action?

  
I need to call a custom javascript function from a ribbon button, how do I include the javascript file within the custom action solution in order that it will be properly referenced by the html output? I am not allowed to define a custom masterpage at this point. So what can I do?   Thanks, Stephan  

Edit CSS path on file that is dynamically created by ASP.NET

  
Hi,I'm not very familiar with .NET so bear with me. The website is question is built in ASP.NET and is using Themes.The external CSS link is outputted on the .master page dynamically by ASP.NET (so I've been told), apparently it generates this code from any CSS file located in /App_Themes/The problem is I need the link to the CSS to begin with a "/" so it points to the root directory.Currently the syntax is: <link href="App_Themes/file/file.css" type="text/css" rel="stylesheet" />And I need it to be <link href="/App_Themes/file/file.css" type="text/css" rel="stylesheet" />Is there anyway I can achieve this?Much thanks,Nick
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend