Forums Register Login

upload txt files only

+Pie Number of slices to send: Send
Hi I am writing a code to allow only txt files to upload.I have written a javascript to allow only .txt files to upload.But if the user gets cranky and renames an exe file to .txt file then on upload i have to prevent it as it results in uploading of junk data Can you please let me know is there a way to know the content type of the file being loaded or any other way i can prevent it. i am using commons-file upload jar
+Pie Number of slices to send: Send
Hi,

just giving you an idea , just get the content and check using unicode values that they are normal charecters(a-z A-Z) or numbers (0-9) if some special charecters are there then don't allow them.

Abdul Mohsin
+Pie Number of slices to send: Send
Nothing to do with SCJP here. Send a PM to a moderator when you can think of the right forum for your topic. Then we will move it for you.
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


Reply locked
This thread has been viewed 713 times.
Similar Threads
FileUpload Word,PDF, Excel Files
Does Java have Wildcards?
allow upload txt files only
Checking File Type
how do I take out the extension in javascript :( urgent ....
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:37:20.