Monthly Archives: June 2009

The Mystery of c:fakepath Unveiled

Have you tried to manipulate the string that is returned by the value attribute of a file upload input (<input type="file" />) under Internet Explorer 8? Did you get the strange c:fakepath string? Relax – there is nothing wrong with your code, and although this is quite confusing, it has its justifiable reasons. Here is a screenshot of a file input control manipulated with JavaScript:

FakePath

According to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. Instead, the string that is returned by the script, which handles the file information is c:fakepath.

This requirement is already implemented in Internet Explorer 8 – the real path to the file will be shown only if the page that contains the control is added to the trusted sites collection of the browser.

Below is some code to play with. Notice that this will not work on localhost pages. The page should be uploaded on a production server.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<title>Testing the FakePath String</title>
</head>
<body>
<form id="Form1" action="" method="post">
<input type="file" /><input type="button" onclick="alert(this.previousSibling.value);" value="select file and press the button" />
</form>
</body>
</html>

More Cool Stuff

Acid.JS Library 3.2 is out with AJAX Hotel Reservation Form

Get most of the website widgets and tools I’m developing in a single package that is regularly updated. Whenever a new script or script update is available, it will be included in the download file. To stay informed and up-to-date with Acid.JS, please, subscribe to my RSS feed.

AJAX Hotel Reservation Form 2.0 Released

Almost two years after the first release of my AJAX Hotel Reservation Form, the new version is finally out – totally rewritten, full of cool features and capable to suit the design of any website with its 12 skins.

Here’s what’s this all about:

AJAX Hotel Reservation Form is full featured AJAX solution for websites that provide online room reservations.

It is skinnable, highly customizable, localizable, crossbrowser and ultra fast. The admin panel of the script allows to review the current reservations, send confirmation emails and delete old reservations. Whenever a new reservation has been sent, you will receive a notification emal, and a a confirmation email will be automatically sent to the person that has made the reservation.

The installation and the configuration of the script is easy, and your form can be up and running on your website within minutes.

Click here to view online demo of AJAX Hotel Reservation Form. You may download the script from this link.

Requirements: PHP, Apache Web Server.

CSS Hack for Internet Explorer 8

Notwithstanding the improvements in the CSS support in Internet Explorer 8, there may be cases when a CSS hack for that particular browser is necessary. Here is one that works in IE8 Standards Compliance Mode:

.classnameOrElement
{
 
color /***/: blue9
}

And another one that will be applied in all IE versions:

.classnameOrElement
{
 color: blue9
}