Solved

Check for file upload on submit

Posted on 2007-11-27
4
2,059 Views
Last Modified: 2013-11-19
Hi

I currently have a HTML form with a file uplaod field within it, I would like to have a javascript check so that everyone HAS to upload a file to submit the form.

At the moment I have a javascript variable being set to True when the file field changes, and a check for true when it is submitted. But people are still not uploading files. Is there a better way to ensure a file is selected?
0
Comment
Question by:logicjb
4 Comments
 

Author Comment

by:logicjb
ID: 20359215
BTW: There are 3 file fields all named: <input ... name="file[]"> ...

Only one file has to be uploaded
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20360474
Hi logicjb:

There is no way to check if they have uploaded a file or not, (ie check to see if they have selected a valid upload file) unless this is done using some server-side language, after submission. Is that an option?
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20943720
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question