Fappie.
Fappie.

Reputation: 490

Uploading picture to the server using javascript

I'm wondering. Is there any way to upload picture to the server with using javascript(jquery)? And save picture path(name) into database?

I'm running Windows platform server in asp .net 1.1. (I'm remaking 10years old web page) There are absolutely no chance to use php that I know well..

Thanks for all comments, I'm pretty desperate..

Upvotes: 2

Views: 1329

Answers (2)

dkoch74
dkoch74

Reputation: 115

http://msdn.microsoft.com/en-us/library/aa479405.aspx

The above link details how you can upload a file using ASP.NET. I don't think you necessarily need Javascript/JQuery unless you're doing some validation on the type or trying to do some additional UI stuff with the uploader.

Upvotes: 0

Blake A. Nichols
Blake A. Nichols

Reputation: 870

You can't directly upload/insert into the database with javascript, you will need some server side code to handle where the file is saved and inserting into the database.

With that said there are a couple options.

First you have traditional forms - <input type="file" />

Secondly you have Drag/Drop and <input type="file" /> dataTransfer object, which contain the base64 encoded version of the binary data from those files. Here is a quick example: http://www.html5rocks.com/en/tutorials/dnd/basics/

Hope that helps!

Upvotes: 1

Related Questions