/    Sign up×
Community /Pin to ProfileBookmark

JS for Uploading

[FONT=Verdana]Hey,

I’m currently working on my web site and I was wanted to know if there was a JS code for allowing the user to upload a file from my site. I’ve seen some that require forms but I want a simple code where the user simply clicks on “Upload file” and they get a promt to Save the file.

Any Takers?
[/FONT]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 20.2006 — JavaScript cannot perform file uploads at all. Period. If it could, this would be considered a security hole. In the browser, only an HTML FORM can be used to upload files.
Copy linkTweet thisAlerts:
@JMRKERJun 20.2006 — Clarification please,

When you say: "upload a file from my site." do you really mean "download...from" or "upload...to"?

You can provide a normal HTML link to a text file you have saved on your system that will allow the user to download information from you, but not upload to you. This method gives the user the message option to "Save the file." to their system from their browser.

Just making sure I understand your question.
Copy linkTweet thisAlerts:
@legendaryauthorJun 20.2006 — I meant "Upload to" I initially wanted to give the option of "Save the file" or "Open file" when they clicked on the link - but the second part cleared it up for me.

Thanks!
Copy linkTweet thisAlerts:
@phpnoviceJun 20.2006 — I want a simple code where the user simply clicks on "Upload file" and they get a promt to Save the file.[/QUOTE]
Oh, I see... Definition first:

You upload to a server.

You download to a client.

Yes, using simple server-side code, the server-side code can tell the browser to open the Save As dialog box (download manager) so that the user can specifiy where to save the file. The file is sent as an HTTP attachment by the server-side code.

Of course, even a standard hyperlink and a ZIP file will do the same thing -- no server-side code required.
×

Success!

Help @legendary spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...