2-in-1 html/web question: file upload button and cookies

stndn

Golden Member
Mar 10, 2001
1,886
0
0
Helo all,

as the title suggests, i have two questions related to web design:

1. How do i remove all cookies that are set by my website on people's browsers? Specifically, how do i use javascript/php/others to tell the browser to make all the cookies ever set by my domain to expire? Can i have a command that removes all cookies regardless of the name of the cookie used (since i forgot them already)?

2. How do i style a file upload inputbox? for example:
<input type="file" style="background-color: #567890;" />
This only make the background color for the textbox (for file upload) has background color of #567890, but not the button that says "browse".
I want the button to change in the look, and also i want it to have something like 5px of margin from the textbox.


Ok, maybe that's a bit more than two questions, but at least they are two topics.... ,)

Thanks.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
php doesn't seem to have alot of cookie functionality. see what you can scrounge out of [l=this]http://www.php.net/manual/en/features.cookies.php[/]

At any rate, in any language that can deal with cookies you should be able to access some sort of collection with which you can iterate over all the cookies without knowledge of what they are called. Then just set the expiration date to some time in the past. I don't know if there's a more direct way to delete them. Some languages that I have done this with are Java and Delphi. Being bigger languages than php or javascript they have nice objects to represent cookies that make everything nice and easy. It doesn't look like you're going to be using stuff like that though.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
found the solution:

foreach ($_COOKIE as $cookie_name => $cookie_value)
{
print "$cookie_name = $cookie_value<br />";
}


now only one problem left... CSS-ing the file upload thing....
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
I don't think it's possible to change the file upload button in most browsers. There's not a lot examples out there but everything I've seen has the default button style.

Just an idea for a workaround: hide the file input and make your own textbox and button. When the button is clicked see if you can fire the file browser for the hidden file input. Then just copy the value from the file input into your custom one to make it look real. You'd also have to be sure that any input typed directly into your text box gets copied into the file input.
I don't know if you could get at the file browsing event in any sort of browser-independent way though. Let us know if you come up with something...