0
 <form action="upload.html" method="post" enctype="multipart/form-data"> <input type="file" /> <input type="submit" value="Upload" /> </form> 

I saved this file as main.html I made a dir called 'images' with chmod 777 what should be in the file called 'upload.html' ?? I don't want to use any php or asp files just html files, so how can I do it by html files only ?

1
  • You can't. AFAIK you need to have a script on the server that handles the upload and places the file in the correct place. Commented Jun 30, 2013 at 4:36

4 Answers 4

3

Client Side (Browser) => Web Server => Script => Server Manipulation

You CANNOT just use HTML files to upload to the server.
Web servers do serve static content (think 'GET') however
when it comes todynamic webpages or the ability for the client (browser)
to POST/PATCH content on the server you would need some sort
of script for that!

Choose perl, php, ruby, python, javascript, or whatever makes
you smile, and put that behind your webserver, with the appropriate
image uploading logic and you're good to upload pictures directly
to your server then :)

Sign up to request clarification or add additional context in comments.

Comments

2

It's simple. You can't.

Call, main.php and have that contain code shown here to upload files to your server. It is fairly simple to do.

Comments

0

Your still going to need to use PHP/ASP somewhere. It's easier to utilize a single PHP file, but if you wanted your end users just to see an .html file instead, you could have it post to a php script file (but it must be a .php extension for the server to execute it).

As mentioned earlier, have a look at the W3 Schools post on PHP file uploading.

Comments

0

The simplest answer is no , you cant do it with the help of html . You need to use php or any server side language to handle file upload .

See this link : W3schools php file upload

Or you can use any other server side languages like asp , python , jsp etc...

An another possiblility is you can use javascript (client side) . Use javascript with ajax ..

See this link Click here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.