mehran
mehran

Reputation: 62

making drag and drop upload with less javascript

I'm trying to make an upload holder for my website, so users can easily drag and drop a file on it.

there is a lot of libraries and events for doing that, but I need a simple way.

this (thought) came to my mind...

I put a file input to the page and sets width and height.

now when my user drag a file on it, onchange event will work.

but I want to hide browse button and there is two way:

set 0 opacity.(it is not working in some browsers)

set hidden visibility.(the thought is not working)

help me, what else I can try?

Upvotes: 1

Views: 261

Answers (1)

Jimmy Breck-McKye
Jimmy Breck-McKye

Reputation: 3034

Put the form on a hidden iframe. Use an ordinary div for the target. When the file is dropped, catch the event and update the input, then submit as post. The result is ajax-like uploading via file drag and drop.

Upvotes: 1

Related Questions