473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 2407
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.de> wrote in
message news:35*************@individual.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******************@newssvr31.news.prodigy.c om...
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*****@agricoreunited.com>
comp.lang.javascript 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
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?...
4
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...
0
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...
1
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...
1
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...
2
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...
10
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...
6
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...
4
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...
5
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.