publish functionality issue fixed

if file is set in URL then write the same file. if not, then create a
new file and write on it.