Hi All,

Am new to this forum and really happy to share my programming thoughts to you all.

It would be great help if some body gives me the the solution for the below.

Case:

When i select a file (through html file control) from local machine, before uploading i want to check if the selected file exist(because,after selecting and before submitting the form,user may change the name/delete the file from the source). so after selecting the file, i need to check the same file exist as it is using javascript/ajax. Back end is JSP.

Eg: Am selecting abc.jpg from my system and changing the file name form the source as abcd.jpg, now abc.jpg does not exist. But i want to check if exist. If selected file does not exist, i want to display a message before uploading/submitting the form.

Thanks,

Yeah... you can't do that. It's up to the user. You can't and will never be able to have direct interaction with the user's filesystem outside of creating cookies.

All you can do is check AFTER they submit the form to see if you got any errors during upload.

Hi ShawnCplus,

Thanks for your reply.
Once the user selects the file, we need to check in the back end process before submitting the form(through ajax) . Am using JSP as back end. is it possible achieving this???

If so, pl send me the sample code. Thanks!

Yeah... you can't do that. It's up to the user. You can't and will never be able to have direct interaction with the user's filesystem outside of creating cookies.

All you can do is check AFTER they submit the form to see if you got any errors during upload.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.