Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to check a file at client side

Reply
Thread Tools

How to check a file at client side

 
 
mhadi
Guest
Posts: n/a
 
      02-14-2004
Hello
Please Help me!! The big bossman is screaming in my ear,
I am only devloper of dotnet in my software house and know only to develop
widows based application !!

My boss wan't me to devolope a page so that when a user clicks a link to to
download a file the page check directory at client side(fixed lets name it
"c:\download") and search for file say "blablav1.1.exe" (version will be
updated)

if file is found then
dont download it
else if it is not then
download the new version and execute it to install

waiting for quick rescue
mhadi


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      02-14-2004
It's no problem to check the client side file system if your clients will be
IE, you can use the VBScript "FileSystemObject" to check if the file is
there or not.

The problem is using the client to cancel the download that has already
begun at the server level.

You might want to try having the link point, not to the file for download,
but to a page that consists of nothing but the code that will check to see
if the user already has the file. If they do, the page can redirect them
back to where they came from without doing anything and if they don't, the
file can redirect them to a page that sends the file down to them.

Check here for info. on using the FSO (also look at the methods link for the
"FileExists" method that you will need):

http://msdn.microsoft.com/library/de...stemobject.asp


"mhadi" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello
> Please Help me!! The big bossman is screaming in my ear,
> I am only devloper of dotnet in my software house and know only to develop
> widows based application !!
>
> My boss wan't me to devolope a page so that when a user clicks a link to

to
> download a file the page check directory at client side(fixed lets name it
> "c:\download") and search for file say "blablav1.1.exe" (version will be
> updated)
>
> if file is found then
> dont download it
> else if it is not then
> download the new version and execute it to install
>
> waiting for quick rescue
> mhadi
>
>



 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      02-14-2004
Here's an old example I dug up...

<HTML>
<HEAD>
<title>Using the FileSystem Object</title>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="VBScript">
Dim fso, myFile

Set fso = CreateObject("Scripting.FileSystemObject")

if fso.FileExists("c:\VBScript.txt") then
'The number 8 represents the 'ForAppending' constant
'The 'True' argument says to create the file if it doesn't exsist
'but in this example, it doesn't matter because we are inside of the
'true condition that tests if the file exists anyway
set myFile = fso.OpenTextFile("c:\VBScript.txt",8, True)
myFile.WriteLine(inputbox("What would you like in your text file?"))
myFile.WriteLine(date & " - " & navigator.appName)
myFile.Close
end if

'************************************************* **************************
*********

Dim Drive, AllDrives
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set AllDrives = fso.Drives

For Each Drive in AllDrives

document.write (Drive.DriveLetter & " - ")

If Drive.DriveType = 3 Then 'Network Drive
document.write (Drive.ShareName)
ElseIf Drive.IsReady Then 'Removable Media with Media Present
document.write (Drive.VolumeName)
End If

document.write("<BR>")
Next

Set myFile = nothing
Set Drives = nothing
set fso = nothing
</SCRIPT>
</BODY>
</HTML>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
no client-side code to check if a file path exists? Matt HTML 2 10-15-2004 11:24 PM
get image side via client side script before file uplaod moondaddy ASP .Net 2 07-16-2004 04:50 AM
Adding custom client-side onClick handler with client-side validator controls Zoe Hart ASP .Net Web Controls 1 01-08-2004 10:45 PM



Advertisments