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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

getting full path of file

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

i am using fileupload javascript control and i want to get i want to get full path of file rather than file name is their any one help me

eg. i m going to select file from c drive it shows only file name rather than full path

this is my code

function preview(field) {
field = document.getElementById( 'upload' ).value;
alert("Before:"+field); //--> this was comment by me
image = document.getElementById( 'previewIMG' );

path = 'file:///'+ field;
path = escape(path);
path = path.replace(/%5C/g, "/");
path = path.replace(/%3A/g, ":");

alert("after="+path); //--> this was comment by me
image.src = path;
image.style.display = 'block';
image.style.width = "200px";
image.style.height = "150px";


<input type="file" name="upload" id="upload" onChange="preview(this.value)"; />
<input type="submit" name"submit" value="Upload Me Now">
<img id="previewIMG" style="display:none;" />

View Complete Post

More Related Resource Links

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, "","test","Value*12"); &

Input type file-: Not getting full path in mozilla


Hi All

I am using Input type = File to get a file from Disk.

<input type=file id="ipFile">

But when i get the value of this i get a file name in Mozilla where as a complete path with file name in I.E.


In I.E. -: D:\bkp\css.txt

In Mozilla -: css.txt

I want to get the Full path in Mozilla too. 

Please help and advice

The file reached the maximum download limit. Check that the full text of the document can be meaning



I'm facing an issue with the indexing.

I have 1 WFE+Index server+DB server.

Index server is not installed with MS FIlter pack 1.0

When crawling, the there will be document with warning in crawl log:
The file reached the maximum download limit. Check that the full text of the document can be meaningfully crawled.

Documents that with warning are such as doc, ppt, xls, docs, ppts and many others.
However, I view into the successful crawled document, there are doucments with ext doc and ppt.

For large file index, there are MaxGrowthFactor + MaxDownLoadSize required to be added into the index server.

As my understanding is, MS Filter Pack should installed into index server(already did, correct me if i'm wrong).

I looked into the Office SharePoint Seach(CA>Services in farm), if the server is appointed to "Use this server as indexing server", then MS Filter Pack is suppose to be installed into that particular server as well.

At the bottom, there also has another option is "Use all web front end for crawling".

The question here is, IF the option "Use all web front end for crawling" is selected.
Does the WED FRONT END Server required to installed the Ms Filte

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




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

Consistently running out of page file memory with full text indexer

Using MS SQL Server 2008 SP1 x64 Standard Edtion on Windows 2008 R2 Enterprise, I'm about to full-text index for the first time 1 table and 2 views. The table contains about 250'000 entries with a data space of 180 MB. As soon as I activate the full text indexing, the fdhost.exe task starts to consume slowly but surely all the available page file space (this can be easily watched using the Resource Monitor and the Commit Charge graph on the memory tab). Once all the virtual memory has been consumed, the server becomes unusable since it can't open any new windows any more, and RDP stops working. The machine specs are as follows: 12 GB of RAM 80 GB free on hard disk out of 136 GB 8 CPUs Custom size paging file with sizes between 24 GB - 60 GB (originally, this was system managed size, but then the server ran out of memory sooner) Max SQL server memory set to 6 GB (first 10 GB, then 8 GB) I've set the max fulltext crawl range to 8. During the indexing, the 8 CPUs are bit busy for a while, but not excessively. What is astonishing is that there is almost no use of physical memory during the indexing (I can see an increase from 2 GB to 3 GB which still leaves plenty of RAM available). Does anybody have an idea how I can convince fdhost.exe to consume physical memory and leave the paging memory alone? Or what else can I try?

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.

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?

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

Path to sqlite database file

Hy,i want access to my database sqlite file from web.config file I've added connection string in web.config but my format is wrong. My database file existx in App_Data Folder.How to add path independet of drive, for example:<connectionStrings>         <add name="CROexport" connectionString="~\App_Data\CROexport.db3;Version=3;" providerName="System.Data.SQLite"/>     </connectionStrings><connectionStrings> <add name="Name" connectionString="~\App_Data\DbFile.db3;Version=3;" providerName="System.Data.SQLite"/> </connectionStrings>I want relative path?I've tried "../../App_Data/", "|App_Data|"

Windows 7, Office 2007, and WSS 3.0: Losing file path when saving to Document Library.

A client of ours recently purchased 5 desktops with Windows 7 and Office 2007.  They use Sharepoint to share all documents for their company. The computers that have Windows XP on them can browse the Sharepoint site, open documents (read only or edit), and chose to Save or Save As.  A new window pops open with their current file path of the Sharepoint Document Library so they can save the file in the same folder they opened it from.  I have tested this with Office 2003 and 2007 (Word and Excel) on XP and it always works. The 5 new desktops running Windows 7 cannot do this.  When a user opens a document by browsing to it from Internet Explorer and chooses to Save or Save As, they are kicked back to their last successful save point (usually My Documents or Desktop). The current work around is mapping a drive to the root Document Library directory and having them traverse through the folders to save it back in the original location. I've tried changing the Check Out save settings in Word 2007 and Excel 2007 to edit directly on the server, but I run into the same problem.  I've also made sure that IE sees the site as a Local Intranet site and Protected Mode is off. Any help would be appreciated.  Thanks in advance.
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