views:

45

answers:

2

When we try to open a blank text file ( 0kb ) using window.open() in php we get an error that the file not exist. But when we open it directly by giving that path to a browser it will open that blank file.

Please help... Thnks.

A: 

With PHP you have to use fopen with 'a','a+','w' or 'w+' to avoid error if file doesn't exist. With JavaScript you can use the FileReader API but it's not implemented on all browsers : http://www.html5rocks.com/tutorials/file/dndfiles/

MatTheCat
@MatTheCat, The file do exists, but it has no data in it and it is a 0kb .txt file. And we are using the window.open() command in the java script to open the file.
rookie
See my edit, window.open doesn't use to open a file but a... window !
MatTheCat
A: 

I have also the same issue. Can anybody give answer for this question?

Shino