By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,730 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,730 IT Pros & Developers. It's quick & easy.

javascript uploader

P: n/a
How do I make this script direct uploads to a folder called incoming.


1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document


<!-- Original: ArjoGod, Shauna Merritt -->
<!-- Modified By: Ronnie T. Moore, Editor -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! -->

<!-- Begin
extArray = new Array(".gif", ".jpg", ".png");
function LimitAttach(form, file) {
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
if (allowSubmit) form.submit();
alert("Please only upload files that end in types: "
+ (extArray.join(" ")) + "\nPlease select a new "
+ "file to upload and submit again.");
// End -->

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->


Please upload only images that end in:
document.write(extArray.join(" "));

<form method=post name=upform action="/cgi-bin/some-script.cgi"
<input type=file name=uploadfile>
<input type=button name="Submit" value="Submit"
onclick="LimitAttach(this.form, this.form.uploadfile.value)">

<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="">The JavaScript

<!-- Script Size: 1.55 KB -->
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On 6 Nov 2003 21:31:32 -0800, in comp.lang.javascript
dv***** (dvdljns) wrote:
| How do I make this script direct uploads to a folder called incoming.

You can't because the script doesn't handle the actual file upload.
The upload process is handled by the 'some-script.cgi'.

Do a Google search on File Upload + <language of your choice>

[snip 2 end]
jn**** : Remove your pants to reply
Jul 20 '05 #2

P: n/a
In article <96************************** >, dv*****
(dvdljns) writes:
How do I make this script direct uploads to a folder called incoming. <snip><form method=post name=upform action="/cgi-bin/some-script.cgi"

you edit the some-script.cgi file to put it in the incoming folder. javascript
has no ability to actually "upload" files. And the script you have is totally
useless, as far as uploading that file. Simply put a form on your page, set the
form, then validate it on the server (which you should be doing anyway). The
only purpose of the script you have *might* be to check the filetype before
Jul 20 '05 #3

P: n/a

Ok thanks! Tell me do you know Where I can get the right stuff to upload

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.