0

I would like to find out if a filename exists in my Image folder, how can I do this in a function using javascript?

How about call a function from Javascript to a C# File? (ON SERVER)

Thank you

3
  • 2
    Short Answer: You can't. Commented Jun 30, 2011 at 14:39
  • How about call a function from Javascript to a C# File? Commented Jun 30, 2011 at 14:41
  • Is the 'Image' folder on the client or server? Commented Jun 30, 2011 at 14:45

4 Answers 4

4

JavaScript from the browser does not have access to your Image folder on your local computer.

Sign up to request clarification or add additional context in comments.

Comments

0

You have to use a server side language. Javascript won't have access to your folders on the server.

Comments

0

you have to provide more context

if your javascript is running within browser and you want to check if file exists on client's computer - you can't

if you want to check Image folder on server - you could do AJAX request for that image and then check if HTTP response code is 200 although that would also blow up your traffic and is not a great choice

best option would be to do AJAX request that will invoke a check on server side like /check?image_name=file.jpg

Comments

0

JavaScript is executed by Browser as Client-side scripting so it doesn't have access to local file system to check whether file exists or not to check file exists or not you need to use Server Side Scripting.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.