If you maintain a remotely-hosted site like on Geocities, Liquid2K, etc. you know that there is usually a text box with a Browse button next to it for uploading files. How could I do that for my site? I've got Apache.
Printable View
If you maintain a remotely-hosted site like on Geocities, Liquid2K, etc. you know that there is usually a text box with a Browse button next to it for uploading files. How could I do that for my site? I've got Apache.
very easy and it will work on any server
<input type="file" value="your_value">
that will show a browse button and a text box so you can upload. beware though there are some problems on sending that file and other variables at the same time. I heard this but never experienced it.
don't you need some upload component to actually upload it?
That's what I was thinking; I know that the actual HTML is easy but I don't know how to specify the directory and other stuff.
it should upload it to that directory where the html page is in. other than that you will need serverside code to put it in another directory.
You need to set the enctype correctly on the form for the browser to properly upload it:
The script you post the form to can read the file data in from standard input. I think the Perl module CGI-Lite's source code might be a good example of how that is done, but why reinvent the wheel when most common server-side scripting technologies have a module or component you can use.Code:<form action="addnew.plx" method="post" enctype="multipart/form-data">
Here's a Perl example:
http://www.oreilly.com/openbook/cgi/appd_01.html
thanks josh, I always seeme to forget the enctype. heh e must be getting old. :D