473,545 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload - <input type=file>

RWK
I'm trying to figure out how to verify that the file trying to be uploaded
exists. On my page if I type in the name of a file that doesn't exist it
get's uploaded as a file with 0 bytes.

When using Yahoo mail when I type in a non-existent file and try to upload
it will come back and tell me "Invalid File" but I can't figure out how they
are doing it.

Help would be appreciated!
RWK
Jul 23 '05 #1
3 2415
RWK wrote:
I'm trying to figure out how to verify that the file trying to be
uploaded exists. On my page if I type in the name of a file that
doesn't exist it get's uploaded as a file with 0 bytes.
For security reasons there should be no chance using client side
JS to check anything in the client's file system.
When using Yahoo mail when I type in a non-existent file and try to
upload it will come back and tell me "Invalid File" but I can't
figure out how they are doing it.


Maybe they simply reject all empty files. Try to upload an existing
file with 0 bytes and see if there's a difference to a non-existing
file. Anyway, they check it on the server, not on the client.

ciao, dhgm
Jul 23 '05 #2
RWK
You're awsome dude... I knew about the restrictions with accessing the local
file system from script so that's why I was stumped as to how Yahoo was
doing it... checking for 0 bytes on the server... easy enough!

Thanks!

"Dietmar Meier" <us************ ***@innoline-systemtechnik.d e> wrote in
message news:35******** *****@individua l.net...
RWK wrote:
I'm trying to figure out how to verify that the file trying to be
uploaded exists. On my page if I type in the name of a file that
doesn't exist it get's uploaded as a file with 0 bytes.


For security reasons there should be no chance using client side
JS to check anything in the client's file system.
When using Yahoo mail when I type in a non-existent file and try to
upload it will come back and tell me "Invalid File" but I can't
figure out how they are doing it.


Maybe they simply reject all empty files. Try to upload an existing
file with 0 bytes and see if there's a difference to a non-existing
file. Anyway, they check it on the server, not on the client.

ciao, dhgm

Jul 23 '05 #3
"RWK" <me@nowhere.com > wrote in message
news:b4******** **********@news svr31.news.prod igy.com...
I'm trying to figure out how to verify that the file trying to be
uploaded
exists. On my page if I type in the name of a file that doesn't exist
it
get's uploaded as a file with 0 bytes.

When using Yahoo mail when I type in a non-existent file and try to
upload
it will come back and tell me "Invalid File" but I can't figure out
how they
are doing it.


I just ran a small test. It's pretty obvious that when you click Attach
Files the file is actually uploaded (and most likely tagged with a
message id so Yahoo! knows which message it "belongs to"). So the server
is detecting that the file is 0 bytes and complaining.

This was verified by -touch-ing a file and attempting to attach it, I
got the same "Invalid File" message.

In other words, the detection is not happening on the client (nor can it
in a cross-platform, cross-browser way).

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20462
by: Don | last post by:
Is there some way to populate the "Browse" box for a <input type=file...> with a default value? I can do it for <input type=text...>, but can't seem to do it for <input type=file...>. Any ideas? Thanks, Don ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
4
6691
by: Bhavin | last post by:
Hi I'm trying to input image file using this synax. <input type=file name="tx_file" accept="image/*" class=boxText> But when open file dialouge appears, it shows all the file and user can select any file and i.e. i dont want. Can any one suggest me? Cheers, Bhavin
0
1681
by: Reza | last post by:
Hello I have a html control, <input type= file ...> and 1. I want the user to select files always from a set location but not sure how or even is this possible 2. If it is possible, can it set to a directoy on the server, web server Thanks in advance Reza
1
2446
by: myahact | last post by:
Hello, I have <input type=file id=myfile> in a form. In IE I can read the value thusly: document.getElementById("myfile").value But thusly returns "" in Mozilla/Netscape. I also tried through the DOM but
1
10850
by: Axe | last post by:
Here's the problem: I've got an ASP.NET (C#) web page that has a single <input type=file> control on it for uploading a file. The way the code works is that the uploaded file is then parsed for the path and file name. I then save the posted file to a temporary directory on the web server (for later processing). I then open up a file stream...
2
28347
by: Evgeny Zoldin | last post by:
Hi ALL. I need to simulate send POST data ( - file upload) as it was submitted in Browser. In C# I create instanse of IE, navigate to page with the form, fill in the fields and try to Submit by call submitButton.click() Unfortunately it does not work while file_filed.vale = <path_to_file> has no effect, value <INPUT type=file...> cound not be...
10
3065
by: Brian Henry | last post by:
Hi, I am having a problem with an attachment system I made... it works with files up to ~3MB in size then after that if you try to upload a file it just goes to a "Page can not be displayed" page like it tried to do it but errored... I thought changeing the max size for the file input box to about 100mb would fix it but nope here is my page...
6
8093
by: reiyel | last post by:
hiya all i would like to ask some help for a little javascript, here's my problem: i have a html page with a <input type="file"> box, problem is i don't want the user to be able to write on the text field, he must use the browse button. i tried a lot of codes but no one works for both IE and firefox i tried to use onclick="blur",m but in that...
4
9060
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image file should not be saved locally before uploading. It should not be visible any <input type=file on the form. How can it be done? I'm working on a...
5
14398
by: magix | last post by:
Hi, with: <Input type="file"...> it will let the user to click to "browse" button to browse for files, question is how can I limit the file type to be only jpg and gif extension, when the browse window open ? thank you.
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7676
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7442
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7776
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.